2017-01-05 69 views
0

我試圖運行npm install我流浪漢箱內,但得到這個錯誤:節點薩斯安裝問題與流浪漢箱

[email protected] install /vagrant/MyStrainGuide/client/node_modules/node-sass 
> node scripts/install.js 

/vagrant/MyStrainGuide/client/node_modules/boom/lib/index.js:146 
     for (i = 0, il = wwwArray.length; i < il; ++ 

SyntaxError: Invalid or unexpected token 
    at Object.exports.runInThisContext (vm.js:78:16) 
    at Module._compile (module.js:543:28) 
    at Object.Module._extensions..js (module.js:580:10) 
    at Module.load (module.js:488:32) 
    at tryModuleLoad (module.js:447:12) 
    at Function.Module._load (module.js:439:3) 
    at Module.require (module.js:498:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (/vagrant/MyStrainGuide/client/node_modules/hawk/lib/index.js:3:33) 
    at Module._compile (module.js:571:32) 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.0.0 (node_modules/chokidar/node_modules/fsevents): 
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 
npm WARN [email protected] requires a peer of [email protected]^0.14.5 but none was installed. 
npm WARN [email protected] requires a peer of [email protected]^0.14.5 but none was installed. 
npm WARN [email protected] No description 
npm WARN [email protected] No repository field. 
npm WARN [email protected] No license field. 
npm WARN ETXTBSY: text file is busy, rmdir '/vagrant/MyStrainGuide/client/node_modules/dashdash/node_modules' 
npm ERR! Linux 3.13.0-105-generic 
npm ERR! argv "/home/vagrant/.nvm/versions/node/v7.4.0/bin/node" "/home/vagrant/.nvm/versions/node/v7.4.0/bin/npm" "install" 
npm ERR! node v7.4.0 
npm ERR! npm v4.0.5 
npm ERR! code ELIFECYCLE 

npm ERR! [email protected] install: `node scripts/install.js` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node scripts/install.js'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the node-sass package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  node scripts/install.js 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs node-sass 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls node-sass 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /vagrant/MyStrainGuide/client/npm-debug.log 

我運行虛擬盒作爲管理員所以不應該有符號鏈接問題。

我已經跑了npm rebuild node-sass根據我的谷歌搜索,仍然沒有解決。

我當前節點的版本是:V7.4.0

NPM版本:4.0.5

我跑這個盒子https://github.com/fideloper/Vaprobash

======

在一個側面說明,我仍然試圖運行服務器使用foreman start -f Procfile.dev

而這是輸出:

02:35:31 client.1 | > webpack -w --config webpack.config.js --watch-poll 
02:35:31 client.1 | 
02:35:32 client.1 | /vagrant/MyStrainGuide/client/node_modules/enhanced-resolve/lib/node.js:60 
02:35:32 client.1 | module.exports.sync = function resolveSync(context, 
02:35:32 client.1 | 
02:35:32 client.1 | SyntaxError: Invalid or unexpected token 
02:35:32 client.1 |  at Object.exports.runInThisContext (vm.js:78:16) 
02:35:32 client.1 |  at Module._compile (module.js:543:28) 
02:35:32 client.1 |  at Object.Module._extensions..js (module.js:580:10) 
02:35:32 client.1 |  at Module.load (module.js:488:32) 
02:35:32 client.1 |  at tryModuleLoad (module.js:447:12) 
02:35:32 client.1 |  at Function.Module._load (module.js:439:3) 
02:35:32 client.1 |  at Module.require (module.js:498:17) 
02:35:32 client.1 |  at require (internal/module.js:20:19) 
02:35:32 client.1 |  at Object.<anonymous> (/vagrant/MyStrainGuide/client/node_modules/webpack/bin/convert-argv.js:4:15) 
02:35:32 client.1 |  at Module._compile (module.js:571:32) 
02:35:32 client.1 | 
02:35:32 client.1 | npm ERR! Linux 3.13.0-105-generic 
02:35:32 client.1 | npm ERR! argv "/home/vagrant/.nvm/versions/node/v7.4.0/bin/node" "/home/vagrant/.nvm/versions/node/v7.4.0/bin/npm" "run" "build:development" 
02:35:32 client.1 | npm ERR! node v7.4.0 
02:35:32 client.1 | npm ERR! npm v4.0.5 
02:35:32 client.1 | npm ERR! code ELIFECYCLE 
02:35:32 client.1 | npm ERR! [email protected] build:development: `webpack -w --config webpack.config.js --watch-poll` 
02:35:32 client.1 | npm ERR! Exit status 1 
02:35:32 client.1 | npm ERR! 
02:35:32 client.1 | npm ERR! Failed at the [email protected] build:development script 'webpack -w --config webpack.config.js --watch-poll'. 
02:35:32 client.1 | npm ERR! Make sure you have the latest version of node.js and npm installed. 
02:35:32 client.1 | npm ERR! If you do, this is most likely a problem with the react-webpack-rails-tutorial package, 
02:35:32 client.1 | npm ERR! not with npm itself. 
02:35:32 client.1 | npm ERR! Tell the author that this fails on your system: 
02:35:32 client.1 | npm ERR!  webpack -w --config webpack.config.js --watch-poll 
02:35:32 client.1 | npm ERR! You can get information on how to open an issue for this project with: 
02:35:32 client.1 | npm ERR!  npm bugs react-webpack-rails-tutorial 
02:35:32 client.1 | npm ERR! Or if that isn't available, you can get their info via: 
02:35:32 client.1 | npm ERR!  npm owner ls react-webpack-rails-tutorial 
02:35:32 client.1 | npm ERR! There is likely additional logging output above. 
02:35:32 client.1 | 
02:35:32 client.1 | npm ERR! Please include the following file with any support request: 
02:35:32 client.1 | npm ERR!  /vagrant/MyStrainGuide/client/npm-debug.log 
02:35:33 client.1 | exited with code 1 
02:35:33 system | sending SIGTERM to all processes 
02:35:33 web.1 | terminated by SIGTERM 

我假設這是因爲npm install沒有正確完成。我以前從未遇到過這個問題。這是我設置的一個全新的盒子。

回答

0

我在這個確切的問題上掙扎了很長一段時間。我能夠用這裏的建議解決它 - https://github.com/mitchellh/vagrant/issues/7163

向下滾動到第二個最後的評論,並按照這些步驟將您的node_modules文件夾移出共享文件夾,這應該修復所有問題。

爲便於這裏的評論

There are some issues with installing the node packages directly in the shared folder. A good workaround is to install the packages somewhere inside the vm then create a symlink.
Ex:
cd /vagrant
rm -rf node_modules
mkdir /home/vagrant/vagrant_node_modules
cp package.json /home/vagrant/vagrant_node_modules
cd /home/vagrant/vagrant_node_modules
npm install
cd /vagrant
ln -s /home/vagrant/vagrant_node_modules/node_modules node_modules
ls -ld node_modules

+0

感謝這個作品!說實話,我只是過渡到使用紗。真的沒有理由再使用npm了。 – Dileet