我正在尝试在我的流浪盒中运行npm install
,但是会收到此错误:
node-sass@4.1.1 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: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN react-markdown-area@0.3.8 requires a peer of react@^0.14.5 but none was installed.
npm WARN react-markdown-area@0.3.8 requires a peer of react-dom@^0.14.5 but none was installed.
npm WARN react-webpack-rails-tutorial@0.0.1 No description
npm WARN react-webpack-rails-tutorial@0.0.1 No repository field.
npm WARN react-webpack-rails-tutorial@0.0.1 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! node-sass@4.1.1 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.1.1 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! react-webpack-rails-tutorial@0.0.1 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 react-webpack-rails-tutorial@0.0.1 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 :(得分:0)
我也在这个问题上苦苦挣扎了很长一段时间。我能够通过这里的建议来解决它 - https://github.com/mitchellh/vagrant/issues/7163
向下滚动到最后一个评论,然后按照这些步骤将node_modules文件夹移出共享文件夹,该文件夹应该为您修复所有内容。
为了方便评论
直接在共享文件夹中安装节点包存在一些问题。一个好的解决方法是在vm中的某个地方安装软件包,然后创建一个符号链接。
例如:
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安装
cd / vagrant
ln -s / home / vagrant / vagrant_node_modules / node_modules node_modules
ls -ld node_modules