Reputation: 21
Im trying to the "npm install on laravel but always encounter this error.
Upvotes: 1
Views: 608
Reputation: 389
I ran into this issue while installing the dependencies, and it looks like you are using cmder
as the CLI
for this. This was my case too, so when I tried to install it from the vsCode terminal, I successfully installed it.
Upvotes: 0
Reputation: 487
I've suffered with this issue for a long time and it seems that the problem is using npm install as a vagrant user inside a laravel/homestead box so the main issue is one of permissions on a synced folder which is the main task of Homestead.yaml.
Referenced in: https://www.vagrantup.com/docs/synced-folders/nfs.html
There's two solutions for this problem:
One will enable you to work from homestead normally, and the other is just like a patch of sorts.
Insert the next line just below your folder mapping on Homestead.yaml
type: "nfs"
Documentation of that here: https://laravel.com/docs/8.x/homestead
Next option is just working from your system, that has all permissions since it owns the folder in wich you are working.
Instead of executing npm install inside vagrant go to the folder in your system (your computer) and use the command from there.
If you need to clean install your project use:
rm -rf node_modules
npm cache clean
Upvotes: 2
Reputation: 10186
Try cleaning your cache and executing a new install:
Execute this at the root of your laravel project:
rm -rf node_modules
npm cache clean
npm install
If it still fails, try rebuilding node sass:
npm rebuild node-sass
Upvotes: 0