Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install error Cannot find module 'read-package-json.js'

Tags:

npm

enter image description here

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

like image 303
John Avatar asked Sep 18 '17 03:09

John


People also ask

Can't find module after npm install?

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.

What is the error Cannot find module?

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.


1 Answers

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
like image 123
webjay Avatar answered Nov 15 '22 09:11

webjay