MeowMeow
MeowMeow

Reputation: 93

NPM Cannot find module 'safe-buffer'

Since I have installed yarn, I cannot use npm anymore.

NodeJS is well upgraded. Impossible to remove npm. Every command I do I got the same error message:

 module.js:487
     throw err;
 ^


 Error: Cannot find module 'safe-buffer'
     at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
   at Module.require (module.js:513:17)     at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:56:14)
    at Module._compile (module.js:569:30)
     at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)     at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

I got: NodeJS v8.2.1, Yarn v0.27.5 (can't npm -v my npm)

Already tried:

I got only 22 lines on my file module.js the error message is talking about, so I cannot have a line 437, 513 or 569 to check.

Upvotes: 3

Views: 10585

Answers (3)

Shawn Lauzon
Shawn Lauzon

Reputation: 6282

I use nvm, so I deleted the node_modules directory there:

rm -rf /Users/shawn/.nvm/versions/node/v6.11.1/lib/node_modules

Then I ran npm install and everything worked.

Upvotes: 0

Sekny
Sekny

Reputation: 11

Actually in my machine even delete global npm or uninstall node.js and install it again but still not work.


so my solution is uninstall npm and go to delete folder npm and npm-cache in C:\Users\pc-name\AppData\Roaming then install it again

Upvotes: 0

MeowMeow
MeowMeow

Reputation: 93

It was impossible to uninstall npm, so I re-install NodeJS from : https://nodejs.org/en/

And it's finally work.

Upvotes: 2

Related Questions