when I install npm as above picture,the error messge show: Error: Cannot find module '/private/var/folders/dm/bzjdbz_s1z1bby3p087g0jr00000gn/T/npm.922/package/bin/read-package-json.js'
details see the pic.any tips?thanks
To fix the Cannot find module error, simply install the missing modules using npm . This will install the project's dependencies into your project so that you can use them. Sometimes, this might still not resolve it for you. In this case, you'll want to just delete your node_modules folder and lock file ( package-lock.
If you are getting the "Cannot find module" error when trying to run a local file, make sure that the path you passed to the node command points to a file that exists. For example, if you run node src/index. js , make sure that the path src/index. js points to an existing file.
Here's how I solved it:
echo prefix=~/.npm-packages >> ~/.npmrc
wget https://registry.npmjs.org/npm/-/npm-5.5.1.tgz
tar xf npm-5.5.1.tgz
cd package
./npm-cli.js install npm -g
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