编辑:请参见下面更新部分,在这里我根据给出的解决方案建议配置家园,为Windows用户工作
我使用的无业游民与我的win7机器上的宅基地修改了代码。我想安装一些gulp软件包,例如gulp-uncss,它不起作用,因为我在下面添加了错误。
一些研究,并在#npm IRC频道讨论我暗示了这个问题以后这里:
根据此项,Windows用户使用的流浪汉时,因为共享仍然有问题主机和来宾机之间的文件夹的最大字符数限制为260个字符,这一直是Windows开发的主要问题。
一个解决方案似乎是改变流浪者档案和规定。
这里是最初的错误:
[email protected]:~/Code/Wordpress/wp-content/themes/expimo$ gulp uncss
[10:51:07~/Code/Wordpress/wp-content/themes/expimo/gulpfile.js
[10:51:07] Starting 'uncss'...
/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/bluebird/js/main/async.js:43
fn = function() { throw arg; };
^
TypeError: Bad argument
at TypeError (native)
at ChildProcess.spawn (child_process.js:1136:26)
at /home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/lib/spawn.js:82:38
at init (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/when/lib/makePro
at new Promise (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/when/lib/makePromise.js:27:53)
at Function.promise (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/when/when.js:97:10)
at startPhantom (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/lib/spawn.js:58:25)
at tryCatchReject (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/when/lib/makePromise.js:845:30)
at runContinuation1 (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/when/lib/makePromise.js:804:4)
at Fulfilled.when (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/when/lib/makePromise.js:592:4)
at Pending.run (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/when/lib/makePromise.js:483:13)
at Scheduler._drain (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/when/lib/Scheduler.js:62:19)
at Scheduler.drain (/home/vagrant/Code/Wordpress/wp-content/themes/expimo/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/when/lib/Scheduler.js:27:9)
at process._tickCallback (node.js:355:11)
正如我刚才从入门的理解,就是我要修改我的Vagrantfile,甚至添加一些规定?
这是我当前的默认Vagrantfile通过宅基地补充说:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
homesteadYamlPath = File.expand_path("~/.homestead/Homestead.yaml")
afterScriptPath = File.expand_path("~/.homestead/after.sh")
aliasesPath = File.expand_path("~/.homestead/aliases")
require_relative 'scripts/homestead.rb'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
end
而且很显然,我必须在这里插入规定的修改: https://github.com/renobit/vagrant-node-env/commit/bdf15f2f301e2b1660b839875e34f172ea8be227
这个Vagrantfile内部,使得宅基地正常工作的窗口。
由于我刚开始使用流浪汉,我的知识非常有限,因此我希望能够就此话题获得任何帮助。先谢谢你。
UPDATE
UPDATE大卫迈尔斯建议:
我修改Vagrantfile根据下面无济于事大卫迈尔斯建议:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
confDir = $confDir ||= File.expand_path("~/.homestead")
homesteadYamlPath = confDir + "/Homestead.yaml"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"
require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
# this should be inserted right before the "Homestead.configure()" line
config.vm.provider "virtualbox" do |v, override|
if Vagrant::Util::Platform.windows?
override.vm.synced_folder "./Code", "/home/vagrant/Code", disabled: true
v.customize ["sharedfolder", "add", :id, "--name", "Code", "--hostpath", (("//?/" + File.dirname(__FILE__) + "/Code").gsub("/","\\"))]
override.vm.provision :shell, inline: "mkdir -p /home/vagrant/Code"
override.vm.provision :shell, inline: "mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` Code /home/vagrant/Code", run: "always"
else
override.vm.synced_folder "./Code", "/home/vagrant/Code"
end
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/Code", "1"]
end
# this should be inserted right before the "Homestead.configure()" line
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
end
而且我也注释掉您在我的Homestead.yaml文件中指出的三行:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
# folders:
# - map: ~/Code
# to: /home/vagrant/Code
sites:
- map: expimo.app
to: /home/vagrant/Code/Wordpress
- map: laravel.app
to: /home/vagrant/Code/laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
不幸的是当时我得到的错误信息:
没有输入文件中指定,因为它似乎这些URI并不指向正确的文件夹。
如果我然后在我的homestead.yaml文件中再次取消注释这三行,并保留修改的Vagrantfile,当我尝试通过“npm install gulp-uncss-”安装gulp-uncss时,保存-dev的”。
接下来应该做什么?
嗨大卫,谢谢你的努力。 Unfortunatley的解决方案似乎并不那么简单,因为它仍然不起作用。我更新了上面的条目以反映您的建议。 – LoveAndHappiness
你介意告诉我共享目录在你的机器上的位置吗? –
它只是在C:/用户/格奥尔格/代码 证明:http://imgur.com/IYLqPEp,lGE9f4Z,d7ak6vQ – LoveAndHappiness