Upon running npm install on a fresh install of Homestead, in a fresh laravel website on a shared folder, I get the following error:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/vagrant/Laravel/testsite/node_modules/yargs/node_modules/yargs-parser/package.json.2388346558
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/vagrant/Laravel/testsite/node_modules/yargs/node_modules/yargs-parser/package.json.2388346558'
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/2019-09-28T14_50_09_294Z-debug.log
I have seen many other threads whihc look similar however, they all discuss the root cause to be interplay between VirtualBox and shared flders with a windows host. I am not using a Windoes host but MacOS.
That said, the above npm command was run on a fresh laravel website (inside the Homestead virtual machine) in a folder which was mapped in from the host. When I ran the test from the home directory of Homestead (i.e., no sshared folders involved) then npm worked as expected.
I am really not sure where the bug is here. I do not belive Windows is not involved in this problem as the host is MacOS. This has worked for many years with no trouble.
MacOS version 10.14.6
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_homestead.pub
keys:
- ~/.ssh/id_homestead
folders:
- map: /Users/liamoreilly/Desktop/Laravel
to: /home/vagrant/Laravel
sites:
- map: testsite.test
to: /home/vagrant/Laravel/testsite/public
databases:
- testsite
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
https://gist.github.com/liamoreilly/88d9c1517f65d6d489874dd513165d2c
npm fails to install the node modules.
npm should work as expected installing the node modules. See above for details
Please run these commands and show the output:
cd ~
laravel new notshared
cd notshared
npm install
Running those commands works fine. Details are shown in
https://gist.github.com/liamoreilly/e3768309c13abb44e992a47b20d2c2ce
I have also run the same commands but within the shared folder. Details are shown in https://gist.github.com/liamoreilly/e92b97f33b05abbf8fa5c77f89eab2af
Note there are 2 files in this Gist - the terminal log and the error log from npm.
I have done a bit more testing with interesting results.
I have used VirtualBox 6.0.12 for all the following tests. Using basically the same Homestead.yaml file as above but with an extra version: xxx line to force a corresponding vagrant box version. Each time I started with no homestead vm (i.e., I ran vagrant destroy) and ran the init.sh script to recreate the Homestead.yaml, after.sh, and aliases files (I edited the Homestead.yaml file afterwards to match the above settings).
Homestead git version | Homestead vagrant box version | npm works?
----------------------|-------------------------------|-----------
9.2.0 | 8.2.0 | No
9.0.0 | 8.0.0 | No
8.3.1 | 8.0.0 | No
8.3.1 | 7.2.1 | Yes
8.6.0 | 7.2.1 | Yes
9.0.3 | 8.0.0 | No
9.0.0 | 8.0.0 | No
----------------------|-------------------------------|-----------
8.6.0 | 7.2.1 | Yes
8.6.0 | 8.0.0-alpha1 | No
The bottom two lines indicate what I think is the point at which npm stops working. I ran the bottom two tests twice with the same result.
I think something broke in the 8.0.0 Homestead box.
Running those commands works fine. Details are shown in https://gist.github.com/liamoreilly/e3768309c13abb44e992a47b20d2c2ce
Because this fails on a Virtualbox folder share, and not in a non-shared folder I'm afraid this is a regression of https://github.com/laravel/homestead/issues/1240 which is not a Homestead issue, it's a Virtualbox Shared Folder issue.
Will try to confirm.
1240
thanks for your input so far.
I am also sure this is something to do with shared folders. However, if it is only a bug in Virtualbox then why does npm in some of my above tests work correctly on the same version of Virtualbox? This I cant explain. I would have thought that it would never work if Virtualbox was the only culprit here. The tests also seem 100% reproducible on my system - it seems there is no randomness involved. The only variable in the last 2 lines of my table is the Homestead box. I guess it is possible that version 8.0.0 is triggering the Virtualbox shared folder bug in some way where was 7.2.1 is not. But it would be good to try to understand what is going on here.
I guess it is possible that version 8.0.0 is triggering the Virtualbox shared folder bug in some way where was 7.2.1 is not. But it would be good to try to understand what is going on here.
I'm hoping to save you some time chasing down versions. Part of debugging #1240 was research into which version of Virtualbox was affected and it was determined the bug appeared only when the box was built with Virtualbox version > 6.0.0.
My assumption is that my uninstalling Virtualbox 6.0.12 (which is what I used to build v8.2.0) and reinstalling Virtualbox 6.0.0 and building a new v8.2.1 box will resolve the issue.
Box v8.2.1 has been released, please update the box and let me know if the error continues.
I tried messing with the guest additions. Again, this produced interesting results.
Here I am using:
When the box 8.0.0-alpha1 is setup initially, it has Virtualbox Guest Additions version 6.0.8 which fails. I uninstalled this, rebooted the VM, installed a different version, reboot VM again, created new Laravel site on the shared folder, and finally ran npm. The results:
Guest Additions version | npm works?
-------------------|-------
6.0.8 (default) | No
6.0.6 (from apt) | No
6.0.0 (from http://download.virtualbox.org/virtualbox/) | Yes
6.0.4 (from http://download.virtualbox.org/virtualbox/) | Yes
6.0.6 (from http://download.virtualbox.org/virtualbox/) | No
From this, it seems that something broke between 6.0.4 and 6.0.6 with the Guest Additions.
Box v8.2.1 has been released, please update the box and let me know if the error continues.
npm worked correctly using Homestead git v8.6.0 and Homestead box 8.2.1.
I notice that v8.2.1 uses the Guest Additions v6.0.0 - so I suspected npm would work.
npm worked correctly using Homestead git v8.6.0 and Homestead box 8.2.1.
This confirms Virtualbox still has not fully fixed the original issue we discovered in #1240, The only thing for Homestead to do in this situation is to continue to use Virtualbox 6.0.0 to build base boxes.
@svpernova09 This problem is back with the latest Homestead box version 9.0.0.
I'm running:
vagrant 2.2.6
Homestead 10.0.0
homestead Box 9.0.0
Mac 10.14.6
Is it feasible that you build the VirtualBox images with VirtualBox 6.0.0 until the underlying bug is addressed?
@svpernova09 This problem is back with the latest Homestead box version 9.0.0.
I'm running:
vagrant 2.2.6
Homestead 10.0.0
homestead Box 9.0.0
Mac 10.14.6Is it feasible that you build the VirtualBox images with VirtualBox 6.0.0 until the underlying bug is addressed?
Well, crap. I checked https://github.com/laravel/homestead/issues/1240#issuecomment-559860990 and it was fine so I assumed this would also be fine. I'm building a new Virtualbox box now and will update once it's released.
Base box v9.0.1 has been released. Built with Virtualbox 6.0.0
I had a similar issue on a fresh install using:
Vagrant 2.2.6
VirtualBox 6.0.12r133076
MacOS 10.14.5
Homestead Box 9.2.2-alpha1
It worked after using nfs:
folders:
...
type: "nfs"
type: "nfs"
I know this is old but I spent hours fighting this problem and was about to just move to yarn seeing it worked fine but type: "nfs" to the homestead.yaml fixed it all so thankyou @gigo6000
What do i do if I am not using homestead and using shared folders in virtual box for development?
I have the same issue as CurvesTech, you found any solution? @CurvesTech
Most helpful comment
I had a similar issue on a fresh install using:
Vagrant 2.2.6VirtualBox 6.0.12r133076MacOS 10.14.5Homestead Box 9.2.2-alpha1It worked after using
nfs: