Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm issue after update

After update npm i cannot use npm install when i run

npm install

i've got

npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './lib/extract-stream.js'

The location of extract-stream.js is /usr/local/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js

If i run

/usr/local/bin/npm install   # IT WORKS!



when i run

which npm 
# output: {my_home_path}/.npm-global/bin/npm   

and when i run

npm -v 
# output: 6.7.0

/usr/local/bin/npm -v
# output 6.5.0

How can i fix this issue?

like image 311
Vito Lipari Avatar asked Jan 27 '19 15:01

Vito Lipari


People also ask

Why my npm is not working?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).

How do I resolve npm start error?

To solve the Missing script: "start" error, make sure to add a start command to the scripts object in your package. json file and open your shell or IDE in the root directory of your project before running the npm start command.

What does NPM update-G MEAN?

The update of the NPM means the update node package manager to the latest version. The update of NPM updates the Node.js and modules to the latest version. Syntax: npm update [-g] [<pkg>...] Here, -g refers to global and pkg refers to package.

What happens if there is no package name in NPM?

If no package name is specified, all packages in the specified location (global or local) will be updated. As of [email protected], the npm update will only inspect top-level packages. Prior versions of npm would also recursively inspect all dependencies. To get the old behavior, use npm --depth 9999 update.

How do I resolve issues with npm install?

Some strange issues can be resolved by simply running npm cache clean and trying again. If you are having trouble with npm install, use the -verbose option to see more details.

How to upgrade one npm package at a time?

More... Manually run the command given in the text to upgrade one package at a time, e.g. npm i --save-dev [email protected] Every now and then after installing your projects dependencies, npm i, you will be met with an error from NPM that looks something like


1 Answers

brew uninstall --force node    
sudo rm -rf /usr/local/lib/node_modules
brew install npm

Worked just fine

like image 163
Алексей Дьяков Avatar answered Sep 18 '22 13:09

Алексей Дьяков