Running any npm command returns this error;
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'readable-stream/transform'
Problem went away once I downgraded Node to v10.14.0. Not sure where the problem starts but it's definitely there in Node v11.9.0 with NPM v6.7.0 but not present on Node v10.14.0 with NPM v6.7.0
Full error log;
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'install',
1 verbose cli '--save-dev',
1 verbose cli 'react',
1 verbose cli 'webpack',
1 verbose cli 'webpack-bundle-tracker',
1 verbose cli 'babel',
1 verbose cli 'babel-loader' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: Cannot find module 'readable-stream/transform'
4 verbose stack at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
4 verbose stack at Function.Module._load (internal/modules/cjs/loader.js:535:25)
4 verbose stack at Module.require (internal/modules/cjs/loader.js:663:17)
4 verbose stack at require (internal/modules/cjs/helpers.js:20:18)
4 verbose stack at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/cacache/node_modules/mississippi/node_modules/through2/through2.js:1:79)
4 verbose stack at Module._compile (internal/modules/cjs/loader.js:734:30)
4 verbose stack at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
4 verbose stack at Module.load (internal/modules/cjs/loader.js:626:32)
4 verbose stack at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
4 verbose stack at Function.Module._load (internal/modules/cjs/loader.js:558:3)
4 verbose stack at Module.require (internal/modules/cjs/loader.js:663:17)
4 verbose stack at require (internal/modules/cjs/helpers.js:20:18)
4 verbose stack at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/cacache/node_modules/mississippi/index.js:5:26)
4 verbose stack at Module._compile (internal/modules/cjs/loader.js:734:30)
4 verbose stack at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
4 verbose stack at Module.load (internal/modules/cjs/loader.js:626:32)
5 verbose cwd /mnt/sshd/Gits/tl40
6 verbose Linux 4.20.6-arch1-1-ARCH
7 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--save-dev" "react" "webpack" "webpack-bundle-tracker" "babel" "babel-loader"
8 verbose node v11.9.0
9 verbose npm v6.7.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'readable-stream/transform'
12 verbose exit [ 1, true ]
@JayTurnr This doesn't looks like a Node.js issue at a first glance, so it should have been reported elsewhere (e.g. Arch Linux or npm issue tracker, or most likely -- nodejs/help).
/usr/lib/node_modules/npm/node_modules/cacache/node_modules/mississippi/node_modules/through2/through2.js
This file is not a part of Arch Linux npm-6.7.0-1 package. Most likely you have an older install of npm which you installed using sudo npm i npm -g. That is not recommended and is known to break (you have two package managers writing to the same location that do not know of each other).
Uninstalling npm with pacman, cleaning the /usr/lib/node_modules/npm dir completely and re-installing npm with either pacman or nvm.sh should help.
Thank you for the prompt reply, I'll try that now.
Edit: That worked! Thank you @ChALkeR
Same problem on Windows 10. I manually removed all files in \Program Files\nodejs and %APPDATA%\npm* and then removed via MSI that I still had in my Downloads folder and reinstalled again from MSI.
Most helpful comment
Same problem on Windows 10. I manually removed all files in
\Program Files\nodejsand%APPDATA%\npm*and then removed via MSI that I still had in my Downloads folder and reinstalled again from MSI.