[BUG] NPM Stopped working when updated.
I updated npm some days ago to 7.6.1 and npm stopped working. I opened a StackOverflow Thread for help (https://stackoverflow.com/questions/66533246/why-did-npm-stopped-working-after-an-update) but I couldn't do nothing
I've tried to reinstall node but it didn't helped me. Every npm command gives me the same error.
Here is an example of what happens.
C:\Users\ethan>npm
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'code-point-at'
Require stack:
- C:\Users\ethan\AppData\Roaming\npm\node_modules\npm\node_modules\gauge\node_modules\string-width\index.js
- C:\Users\ethan\AppData\Roaming\npm\node_modules\npm\node_modules\gauge\wide-truncate.js
- C:\Users\ethan\AppData\Roaming\npm\node_modules\npm\node_modules\gauge\render-template.js
- C:\Users\ethan\AppData\Roaming\npm\node_modules\npm\node_modules\gauge\plumbing.js
- C:\Users\ethan\AppData\Roaming\npm\node_modules\npm\node_modules\gauge\index.js
- C:\Users\ethan\AppData\Roaming\npm\node_modules\npm\node_modules\npmlog\log.js
- C:\Users\ethan\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\ethan\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\ethan\AppData\Roaming\npm\node_modules\npm\node_modules\gauge\node_modules\string-width\index.js:3:19)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\ethan\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\gauge\\node_modules\\string-width\\index.js',
'C:\\Users\\ethan\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\gauge\\wide-truncate.js',
'C:\\Users\\ethan\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\gauge\\render-template.js',
'C:\\Users\\ethan\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\gauge\\plumbing.js',
'C:\\Users\\ethan\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\gauge\\index.js',
'C:\\Users\\ethan\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\npmlog\\log.js',
'C:\\Users\\ethan\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js',
'C:\\Users\\ethan\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'
]
}
My enviroment is: Windows 10 20H2 Node: 14.16.0 npm: 7.6.1
@TheSpeddyEthanYT can you try replicating this problem on the latest version of npm? (ie. npm i -g npm)
@hamzajaffar and @armelangton — please work with Darcy to investigate the issue (https://github.com/nodejs/node/issues/38317).
- Type this in cmd or terminal: npm install -g expo-cli --force
- Now type the command again for installing truffle: npm install truffle -g WORKED FOR ME :)
https://stackoverflow.com/questions/58949120/error-cannot-find-module-c-users-senyo-appdata-roaming-npm-node-modules-expo Got help from here ^
Tried the solution of @ssr-02kk - still the same result
node:internal/modules/cjs/loader:933 const err = new Error(message); ^
Error: Cannot find module 'code-point-at' Require stack:
- C:\Program Files\nodejs\node_modules\npm\node_modules\wide-align\node_modules\string-width\index.js
- C:\Program Files\nodejs\node_modules\npm\node_modules\wide-align\align.js
- C:\Program Files\nodejs\node_modules\npm\node_modules\gauge\lib\render-template.js
- C:\Program Files\nodejs\node_modules\npm\node_modules\gauge\lib\plumbing.js
- C:\Program Files\nodejs\node_modules\npm\node_modules\gauge\lib\index.js
- C:\Program Files\nodejs\node_modules\npm\node_modules\npmlog\lib\log.js
- C:\Program Files\nodejs\node_modules\npm\lib\utils\log-shim.js
- C:\Program Files\nodejs\node_modules\npm\lib\utils\exit-handler.js
for me, the node_modules file was missing. check if it is there. To solve the problem I simply went to the control panel->uninstall apps->nodejs(right-click on nodejs)-> select repair. My node_modules file was back.
https://stackoverflow.com/questions/58949120/error-cannot-find-module-c-users-senyo-appdata-roaming-npm-node-modules-expo Got help from here
What I did was installing the missing module by downloading it from other source (Windows Ubuntu CLI on my case) and pasting it onto the packages folder.
FWIW, I ran into this issue while attempting to execute the setup-node action with the following syntax:
- name: Setup Node @ 16
uses: actions/setup-node@v3
with:
node-version: 16
token: ${{ secrets.GH_GITHUB_COM_TOKEN }}
which produced the following error:
Warning: node:internal/modules/cjs/loader:995
const err = new Error(message);
^
Error: Cannot find module './ranges/to-comparators'
Require stack:
- /opt/hostedtoolcache/node/16.19.0/x64/lib/node_modules/npm/node_modules/semver/index.js
- /opt/hostedtoolcache/node/16.19.0/x64/lib/node_modules/npm/lib/cli.js
- /opt/hostedtoolcache/node/16.19.0/x64/lib/node_modules/npm/bin/npm-cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Function.Module._load (node:internal/modules/cjs/loader:841:27)
at Module.require (node:internal/modules/cjs/loader:1067:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/opt/hostedtoolcache/node/16.19.0/x64/lib/node_modules/npm/node_modules/semver/index.js:37:18)
at Module._compile (node:internal/modules/cjs/loader:1165:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
at Module.load (node:internal/modules/cjs/loader:1043:32)
at Function.Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1067:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/opt/hostedtoolcache/node/16.19.0/x64/lib/node_modules/npm/node_modules/semver/index.js',
'/opt/hostedtoolcache/node/16.19.0/x64/lib/node_modules/npm/lib/cli.js',
'/opt/hostedtoolcache/node/16.19.0/x64/lib/node_modules/npm/bin/npm-cli.js'
]
}