I'm trying to run npm install
inside my vagrant box but get this error:
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
I'm running the virtual box as an admin so there shouldn't be a symlink issue.
I've ran npm rebuild node-sass
based on my google searches and still not resolved.
My current node version is: v7.4.0
npm version is: 4.0.5
I'm running this box https://github.com/fideloper/Vaprobash
======
On a side note, I still tried to run the server using foreman start -f Procfile.dev
And this is the output:
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
I'm assuming this is because the npm install
didn't finish properly. I never had this issue before. This is a fresh new box that I setup.
I was struggling with this exact issue for quite a while as well. I was able to resolve it with the advice on here - https://github.com/mitchellh/vagrant/issues/7163
Scroll down to the second last comment and follow those steps to move your node_modules folder out of the shared folder, that should fix everything for you.
For ease here's the comment
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