Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • remove node_modules folder from my projet and re-install it using npm install (got same error message).
  • npm upgrade, npm cache clear, npm cache rm, npm install safe buffer

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.

like image 421
MeowMeow Avatar asked Jan 01 '26 17:01

MeowMeow


1 Answers

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

And it's finally work.

like image 109
MeowMeow Avatar answered Jan 03 '26 06:01

MeowMeow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!