Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run npm install on clean install. #752

Closed
craigalways opened this issue Dec 4, 2017 · 6 comments

Comments

@craigalways
Copy link

commented Dec 4, 2017

Versions

  • Vagrant: 2.0.1
  • Provider: vagrant-vmware-fusion (5.0.4)
  • Box laravel/homestead (v5.0.1)

Host operating system

MacOS High Sierra 10.13.1 (17B1003)

Homestead.yaml


ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: vmware_fusion

authorize: ~/.ssh/id_rsa.pub

keys:
- ~/.ssh/id_rsa

folders:
- map: ~/code/
to: /home/vagrant/code/

sites:
- map: hodgehill.test
to: /home/vagrant/code/hodgehill/public

databases:
- homestead


Issue

NPM Install falls over with this error.

npm ERR! path /home/vagrant/code/hodgehill/node_modules/.acorn-dynamic-import.DELETE/node_modules/acorn
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/home/vagrant/code/hodgehill/node_modules/.acorn-dynamic-import.DELETE/node_modules/acorn' -> '/home/vagrant/code/hodgehill/node_modules/acorn-dynamic-import/node_modules/acorn'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2017-12-04T20_55_21_208Z-debug.log

Steps to reproduce

  1. vagrant destroy
  2. vagrant destroy
  3. vagrant ssh
  4. NPM Install
@svpernova09

This comment has been minimized.

Copy link
Member

commented Dec 4, 2017

Does the error happen when running NPM from your mac?

Can you post the contents of /home/vagrant/.npm/_logs/2017-12-04T20_55_21_208Z-debug.log and your package.json

@craigalways

This comment has been minimized.

Copy link
Author

commented Dec 4, 2017

I don't have NPM on my Mac.

Here is the exciting stuff at the end.

23939 silly remove /home/vagrant/code/hodgehill/node_modules/path-type
23940 silly remove /home/vagrant/code/hodgehill/node_modules/preserve
23941 silly remove /home/vagrant/code/hodgehill/node_modules/process
23942 silly remove /home/vagrant/code/hodgehill/node_modules/process-nextick-args
23943 silly remove /home/vagrant/code/hodgehill/node_modules/prr
23944 silly remove /home/vagrant/code/hodgehill/node_modules/errno
23945 silly remove /home/vagrant/code/hodgehill/node_modules/punycode
23946 silly remove /home/vagrant/code/hodgehill/node_modules/querystring
23947 silly remove /home/vagrant/code/hodgehill/node_modules/querystring-es3
23948 silly doSerial move 11228
23949 silly doSerial finalize 11228
23950 silly finalize /home/vagrant/code/hodgehill/node_modules/abbrev
23951 silly finalize /home/vagrant/code/hodgehill/node_modules/acorn
23952 silly finalize /home/vagrant/code/hodgehill/node_modules/acorn-dynamic-import/node_modules/acorn
23953 silly finalize /home/vagrant/code/hodgehill/node_modules/acorn-dynamic-import
23954 verbose unlock done using /home/vagrant/.npm/_locks/staging-76c5875edd92d088.lock for /home/vagrant/code/hodgehi$
23955 verbose stack Error: ENOENT: no such file or directory, rename '/home/vagrant/code/hodgehill/node_modules/.acorn$
23956 verbose cwd /home/vagrant/code/hodgehill
23957 verbose Linux 4.4.0-101-generic
23958 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
23959 verbose node v8.9.1
23960 verbose npm v5.5.1
23961 error path /home/vagrant/code/hodgehill/node_modules/.acorn-dynamic-import.DELETE/node_modules/acorn
23962 error code ENOENT
23963 error errno -2
23964 error syscall rename
23965 error enoent ENOENT: no such file or directory, rename '/home/vagrant/code/hodgehill/node_modules/.acorn-dynamic$
23966 error enoent This is related to npm not being able to find a file.
23967 verbose exit [ -2, true ]

package.json

{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.16.2",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.1.1",
"jquery": "^3.1.1",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.1.10"
},
"dependencies": {}
}

@svpernova09

This comment has been minimized.

Copy link
Member

commented Dec 4, 2017

Not sure how much help I'm going to be. Google shows it could be symlinking issues (but you're not on windows) and some mounting issues (But your shared bits of logs don't mention it).

Try rm -rf node_modules && npm install. If the error persists you can check if it's possibly an NPM issue by trying rm -rf node_modules && yarn install.

@craigalways

This comment has been minimized.

Copy link
Author

commented Dec 4, 2017

Thanks for your help @svpernova09 it was as NPM issue yarn worked great.

@svpernova09 svpernova09 closed this Dec 4, 2017

@cncqw

This comment has been minimized.

Copy link

commented Jun 21, 2018

Install node.js on your Windows host and execute npm install in the code directory

@dylanbr

This comment has been minimized.

Copy link

commented Sep 3, 2018

The underlying problem is related to how Windows file locking is handled by Virtualbox sharing. It happens whether using standard shared folders (vboxsf) or nfs. If a file is opened or read (locked) by another process while npm is trying to change it the whole install process fails.

How to fix:

  1. Run vagrant up (and other commands) from an administrator terminal. This ensures symlinks work correctly. There are other ways to enable symlinks - if you use one of them be sure to test them out using ln -s a b within the shared folder.
  2. Ensure that no other process opens any of the files in the shared folder by either disabling the process or excluding the vagrant folder. This includes, but is not limited to:
    1. Windows Defender or other anti virus software
    2. Windows search index or other indexing software
    3. Dropbox or other file synchronisation software.

If you are still having issues with point 2 above, you can use Process Monitor, filtered to your vagrant directory, to detect access by any process other than Virtualbox (VBoxHeadless.exe).

With the above in place I am able to successfully run npm install without issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.