Please note that the Homestead issue tracker is reserved for bug reports and enhancements. We are not always able to debug Vagrant, Provider or Operating System issues but will do our best to help. Thank you!
Vagrant: Run vagrant -v to show the version.
Vagrant 1.9.2
Provider: Virtualbox, VMWare or Parallels and it's version.
VirtualBox
Homestead: Run homestead --version to show the version.
5.3.2
This is the operating system that you run locally.
Windows 10 64 bit.
---
name: homestead7
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: /Users/Jonathan/Dropbox/Documents/SSH-Keys/Homestead/homestead.pub
keys:
- /Users/Jonathan/<snip>/private.key
folders:
- map: /Code
to: /home/vagrant/Code
sites:
- map: new.app
to: /home/vagrant/Code/new.app/public
databases:
- homestead
ports:
- send: 80
to: 80
- send: 443
to: 443
Before you begin
run as administratorMy npm verison is 5.0.3 (but has existed in all versions)
1) Create a new folder like /code/npmBug
2) Create a package.json file in it with the following
{
"devDependencies": {
"babel-cli": "^6.24.1"
}
}
3) Save it then run npm install
21:43:08 ✔ vagrant@homestead $ npm install
> [email protected] install /home/vagrant/Code/npmbug/node_modules/fsevents
> node install
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN npmbug No description
npm WARN npmbug No repository field.
npm WARN npmbug No license field.
added 182 packages in 35.105s
What actually happened?
[~/Code/npmbug]
22:01:19 ✔ vagrant@homestead $ npm install
npm WARN npmbug No description
npm WARN npmbug No repository field.
npm WARN npmbug No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents/node_modules/node-pre-gyp):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/vagrant/Code/npmbug/node_modules/fsevents/node_modules/node-pre-gyp' -> '/home/vagrant/Code/npmbug/node_modules/fsevents/node_modules/.node-pre-gyp.DELETE'
npm ERR! path ../babel-cli/bin/babel.js
npm ERR! code EPROTO
npm ERR! errno -71
npm ERR! syscall symlink
npm ERR! EPROTO: protocol error, symlink '../babel-cli/bin/babel.js' -> '/home/vagrant/Code/npmbug/node_modules/.bin/babel'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2017-07-13T22_02_13_998Z-debug.log
If we start Vagrant as a windows admin account (eg open command prompt by right clicking on cmd icon and selecting Run as administrator, then start vagrant/homestead as normal)
None of these issues then appear. All npm commands work and symlinks are created during the install process successfully.
I did attempt to use this PR: https://github.com/laravel/homestead/pull/609 and ran vagrant as a normal user. However when running the command npm install it again produced a symlink error and installation was a failure.
Because of this, I'm not sure if there's any real fix for windows hosts.
Are there any other GitHub issues (open or closed) that should be linked here?
For example:
Basically there no need for me to write anything else as it's all covered here in the issue below!
https://github.com/npm/npm/issues/7308 but more specifically, everything after:
https://github.com/npm/npm/issues/7308#issuecomment-84214837
Thanks for taking the time to write this up. As I expected this is caused by not running the console application as administrator (therefore running vagrant as Administrator). There isn't anything we can do to fix this for windows users (and not make a change that would affect all platforms as the previous PR showed).
Sounds like the best advice is to run Vagrant as an administrator on Windows, or use the Linux subsystem to create your projects instead of doing it in Homestead.
On Windows use Babun
npm install --no-bin-links as a workaround resolved the issue for me.
The problem is that npm install is trying to create symlinks on an NTFS file system, which doesn't have that feature. So with the --no-bin-links option it will copy all references to the same node projects as needed.
By the way, if you already ran npm install, you have to delete the node_modules directory (rm -rf node_modules) before running npm install --no-bin-links or otherwise it'll still fail at the same place.
I've updated the documentation to add a note about this for others
https://github.com/laravel/docs/pull/5456
Just in case anyone else stumbles on this, running npm v6.14.3 I also had to clear the cache to get the installer working correctly:
rm -rf node_modules
npm cache clean --force
npm install --no-bin-links
Most helpful comment
npm install --no-bin-linksas a workaround resolved the issue for me.