I'm getting the following error when trying to do anything with npm:
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:153:3)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
I can't run npx create-react-app or any npm commands including uninstalling or updating npm. Yesterday I installed yarn, could that be part of the problem? I also updated my Mac to Catalina 10.15.5 recently. I'm not sure if either/both of these caused the npm issue or not.
What's causing this and how can I fix it?
Found a solution. A modified version of this answer worked.
I ran:
brew uninstall --force node
sudo rm -r /usr/local/lib/node_modules
brew install node
and that did the trick.
Related
So I recently started learning React Native by following a Udemy course. Until now, everything has worked just fine, but a couple of days ago I got this error message when running the simple "npm start" command. I've tried a few solutions like reinstalling the node_modules folder, updating everything to the latest version, but that did not help. Has anybody got the solution for this?
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'xdl'
Require stack:
- C:\Users\Korisnik\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js
- C:\Users\Korisnik\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at _xdl (C:\Users\Kori
snik\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js:152:16)
at Object.<anonymous> (C:\Users\Korisnik\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js:282:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Korisnik\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\build\\exp.js',
'C:\\Users\\Korisnik\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\bin\\expo.js'
]
}
Thanks in advance!
download the Git Bash and install it , once it's installed open as administrator and write the code
npm install -g expo-cli --force
I have a project on Github that ignores the node_modules folder, so I changed my computer and and cloned the repository again.
I used the npm-install-all install all node dependencies, it used to work.
But today when doing this and running react-scripts start I had this problem:
internal/modules/cjs/loader.js:888
throw err;
^
Error: Cannot find module 'which'
Require stack:
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\node_modules\cross-spawn\lib\util\resolveCommand.js
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\node_modules\cross-spawn\lib\parse.js
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\node_modules\cross-spawn\index.js
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\crossSpawn.js
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-scripts\bin\react-scripts.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\node_modules\cross-spawn\lib\util\resolveCommand.js:4:13)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-dev-utils\\node_modules\\cross-spawn\\lib\\util\\resolveCommand.js',
'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-dev-utils\\node_modules\\cross-spawn\\lib\\parse.js',
'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-dev-utils\\node_modules\\cross-spawn\\index.js',
'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-dev-utils\\crossSpawn.js',
'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-scripts\\bin\\react-scripts.js'
]
I already tried to update the modules with npm install.
Has anyone been through this and can you help me, please?
Thanks.
I finally got it!
If you have the same problem, try:
rm -rf node_modules
then remove your package-lock.json and
npm install
For me it was an xcode issue.
Remove xcode cli tools: sudo rm -r -f /Library/Developer/CommandLineTools
Reinstall: xcode-select --install
Then, delete node modules. Manually or with rm -rf node_modules
Should be good to go: npm install then npm start
https://github.com/haileemiu/Notes/blob/main/Troubleshooting/npm.md
this problem occur in node version-17 just download version-16 and it works
I am working on a Reactjs project and was in the process of installing Electron. Every time I tried to install Electron globally I didn't have permission. I thought that by installing Homebrew I wouldn't run into this problem anymore. However, it created a bigger issue. I uninstalled homebrew to go back to my base. Now, every time I run NPM I get this error message:
Error: Cannot find module 'buffer-shims'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous>
(/usr/local/lib/node_modules/npm/node_modules/readable-
stream/lib/_stream_readable.js:36:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I had this problem on my Mac. When I was trying to update npm.
/usr/local/lib/node_modules was owned by root and not by me on my machine.
I did a sudo chown -R <username_here> /usr/local/lib/node_modules on that directory. Then I deleted the whole directory rm -r /usr/local/lib/node_modules and then did a brew uninstall npm and a brew reinstall npm to fix this issue.
Starting a new project, I've installed the latest versions of webpack and webpack-dev-server. I've added the webpack-dev-server command to my start script in my package.json. Oddly, the dev server was working the first time I ran the project, but I then blew away my node_modules folder and reinstalled. Since reinstalling I am continually blocked by the following missing dependency error.
npm start
> webpack-dev-server
module.js:442
throw err;
^
Error: Cannot find module 'hpack.js'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/a6001382/analytics/analytics-q/node_modules/spdy-transport/lib/spdy-transport/protocol/http2/hpack-pool.js:5:13)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
spdy-transport seems to be the culprit, but I am still getting the error even after explicitly running "npm install" on spdy-transports root, and ensuring that "hpack.js" exists.
Has anyone else experienced this missing dependency?
Resolved by running npm i -g npm#latest-4. Some versions of NPM don't correctly set the "main" field of package.json if the package contains a period.
I tried to setup ghost after installing node.js but as I run the install for ghost as
npm install --productions
It gives me the following error
> ghost#0.5.10 start /home/kedarkhetia/Downloads/ghost-0.5.10
> node index
module.js:340
throw err;
^
Error: Cannot find module 'streamsearch'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/kedarkhetia/Downloads/ghost-0.5.10/node_modules/busboy/node_modules/dicer/lib/Dicer.js:5:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
any help is appreciated.
Try running
npm install streamsearch
Does this work?
This may be related:
Cannot install packages using node package manager in Ubuntu
Make sure you have installed streamsearch.
npm install streamsearch
If it is still not working, check that you have cloned stable for production or not. If you did, re-clone it and do installation steps again. Use sudo for npm/grunt commands (if you are on OSX or Linux) for npm ERR!.
I just looked at the Ghost Docs, and it says to install the dependencies for production you must run npm install --production and not npm install --productions. Once you install streamsearch, it will keep complaining until you have installed all the individual dependencies with npm install --production.
Hope this helps!