Since I have installed yarn, I cannot use npm
anymore.
NodeJS
is well upgraded. Impossible to remove npm
. Every mand 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._pile (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.
Since I have installed yarn, I cannot use npm
anymore.
NodeJS
is well upgraded. Impossible to remove npm
. Every mand 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._pile (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.
- Have you googled "Error: Cannot find module 'safe-buffer' at Function.Module._resolveFilename"? There are plenty of similar problems and suggested solutions. Try updating / re-installing NPM. – Steven Commented Aug 15, 2017 at 10:16
- You need run npm install in the directory with your package.json. – Neji Soltani Commented Aug 15, 2017 at 12:10
- I tried many thing I found on Google since two days, or similar error. But still got it. I had also removed the node_modules from my project and run npm install (at the same place of my package.jason), but I got the same message for all npm mand. – MeowMeow Commented Aug 15, 2017 at 15:09
3 Answers
Reset to default 2It was impossible to uninstall npm, so I re-install NodeJS from : https://nodejs/en/
And it's finally work.
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
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.