All i'm trying to do is npm install command inside fresh installed Laravel app, but i keep getting errors.
After googling for two days and trying everything i found as a possible solution for npm install error i decided to try one more time reinstalling everything in hope that would fix my issue with npm install but unfortunately that didn't help either.
I tried deleting node_modules,
cleaning npm cache,
sudo npm install,
sudo npm install --no-bin-links,
updating node and npm but both were at latest version already,
changing VagrantFile based on some posts i've seen around internet(that never worked because than i'd get an error when i use vagrant up),
reinstalling everything,
running bash as admin,
I can't even remember everything I've done. This became really exhausing.
My log is 17k+ lines long. I'll just post last part where error happens.
17734 verbose stack Error: ENOENT: no such file or directory, open '/home/vagrant/code/vue-test/node_modules/yargs/node_modules/yargs-parser/package.json.2655513948'
17735 verbose cwd /home/vagrant/code/vue-test
17736 verbose Linux 4.15.0-54-generic
17737 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--no-bin-links"
17738 verbose node v12.5.0
17739 verbose npm v6.10.1
17740 error path /home/vagrant/code/vue-test/node_modules/yargs/node_modules/yargs-parser/package.json.2655513948
17741 error code ENOENT
17742 error errno -2
17743 error syscall open
17744 error enoent ENOENT: no such file or directory, open '/home/vagrant/code/vue-test/node_modules/yargs/node_modules/yargs-parser/package.json.2655513948'
17745 error enoent This is related to npm not being able to find a file.
17746 verbose exit [ -2, true ]
My last hope is to ask if someone has a solution for this or i should just give up on Homestead.
Yeah, while npm run watch , just saving the your update on app. js will automatically re-compile app. js to add the module. Man!
You can do this by cloning Homestead into your home directory. You can add it anywhere, but Laravel suggests for your to add it to your home directory (C:/users/your-user-name) since it can serve as a central location for all of your Laravel projects. For this, use Git Bash since it will automatically translate ~/Homestead to your home directory.
There's a solution. Change your website folder location from Desktop or any to C:\ directly. Try again to npm install. It should work. :) Thanks for contributing an answer to Stack Overflow!
I found the problem, NodeJS comes installed with NPM, but it's a pretty old version. Just did npm install npm -g to resolve my problems. Show activity on this post. These commands need to run on a fresh Laravel installation, otherwise you will face many errors. Want to get started fast?
These commands need to run on a fresh Laravel installation, otherwise you will face many errors. Want to get started fast? Install the laravel/ui Composer package and run php artisan ui vue --auth in a fresh Laravel application. Show activity on this post. Disable AntiVirus software, if you are running any also try to run npm cache clean.
I have grappled with the exact same issue for the last two days, except that I run on macOS (10.14). Using yarn
instead of npm
has finally allowed me to compile properly (see the doc for installing the package: https://yarnpkg.com/lang/en/docs/install/#alternatives-stable). It is a package manager that can use the same package.json
entry point as npm
, and you can simply try to run yarn install
to perform the same action as npm install
(for more in depth comparison between the commands, you can check out this link: https://yarnpkg.com/lang/en/docs/migrating-from-npm/). To be sure, it does not fix the main issue with npm, but at least it should allow you to work on your project while waiting for a more sound answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With