npm install errors on vagrant/homestead/windows: EPROTO: protocol error, symlink
I had same problem. I did below. It works fine.
npm install --no-bin-links
I have been trying to figure out this problem for weeks. Here is what I did to make it work without using my host environment:
I updated node to the latest version in homestead according to nodesource.com:
sudo apt-get install --yes nodejs
curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
I updated npm to the latest version in homestead. This should be done after updating node:
sudo npm -g install npm@latest
I ran npm install in the laravel project directory. I also had to use force to get all of the dependencies to install:
sudo npm install --no-bin-links
sudo npm cache clear
sudo npm install --force --no-bin-links
I rebuilt node-sass according to a gulp error:
sudo npm rebuild node-sass --no-bin-links
During this whole process if something fails or after each install, i used:
sudo npm cache clear
My host is windows 10, with latest virtualbox, latest vagrant, latest homestead. I used git bash as administrator and ssh into vagrant using git bash.
So far I have only tested and confirmed that my gulp works. It is possible that other dependencies need to be rebuilt.
Hope this helps!
As many of you that are also setting up Homestead with Virtual Box...
After googling for a solution I decided to refer back to the Laravel Homestead documentation. Fortunately the solution was posted there:
https://laravel.com/docs/5.8/homestead#provider-specific-settings
You just need to add the following to your homestead Vagrantfile.
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
(...)
config.vm.provider "virtualbox" do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end
(...)
end
IMPORTANT
Don't forget to provision as an administrator.
homestead up --provision
The cause of your initial EACCES
error was that you used sudo
without using the -H
option. NEVER use sudo npm
. ALWAYS use sudo -H npm
.
The instructions on the Internet everywhere (including NPM docs) are simply wrong.