why does npm start fail? - node.js

I am trying to run some React code but receiving this error on vs code. I am not sure what the issue is.
node:internal/modules/cjs/loader:998
throw err;
^
Error: Cannot find module 'parseurl'
Require stack:
- C:\Users\hp\Desktop\Programming\Projects\apexgrade\node_modules\finalhandler\index.js
- C:\Users\hp\Desktop\Programming\Projects\apexgrade\node_modules\express\lib\application.js
- C:\Users\hp\Desktop\Programming\Projects\apexgrade\node_modules\express\lib\express.js
- C:\Users\hp\Desktop\Programming\Projects\apexgrade\node_modules\express\index.js
- C:\Users\hp\Desktop\Programming\Projects\apexgrade\node_modules\webpack-dev-server\lib\Server.js
- C:\Users\hp\Desktop\Programming\Projects\apexgrade\node_modules\react-scripts\scripts\start.js
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module._load (node:internal/modules/cjs/loader:841:27)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\hp\Desktop\Programming\Projects\apexgrade\node_modules\finalhandler\index.js:18:16)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\hp\\Desktop\\Programming\\Projects\\apexgrade\\node_modules\\finalhandler\\index.js',
'C:\\Users\\hp\\Desktop\\Programming\\Projects\\apexgrade\\node_modules\\express\\lib\\application.js',
'C:\\Users\\hp\\Desktop\\Programming\\Projects\\apexgrade\\node_modules\\express\\lib\\express.js',
'C:\\Users\\hp\\Desktop\\Programming\\Projects\\apexgrade\\node_modules\\express\\index.js',
'C:\\Users\\hp\\Desktop\\Programming\\Projects\\apexgrade\\node_modules\\webpack-dev-server\\lib\\Server.js',
'C:\\Users\\hp\\Desktop\\Programming\\Projects\\apexgrade\\node_modules\\react-scripts\\scripts\\start.js'
]
}
i have tried using npm install, but that doesnt seem to solve the problem

I think your package-lock.json don't have parseurl package. Since parseurl is dependency of express. Try to install parseurl with command.
run step by step follow bellow command.
npm uninstall express
npm install express
or npm install parseurl

Related

Error when running npm, Cannot find module 'semver'

I just installed npm and nodejs. However, after updating nodejs, running npm givesd me this error:
node:internal/modules/cjs/loader:1063
throw err;
^
Error: Cannot find module 'semver'
Require stack:
- /usr/share/npm/lib/utils/unsupported.js
- /usr/share/npm/bin/npm-cli.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1060:15)
at Module._load (node:internal/modules/cjs/loader:905:27)
at Module.require (node:internal/modules/cjs/loader:1127:19)
at require (node:internal/modules/helpers:112:18)
at Object.<anonymous> (/usr/share/npm/lib/utils/unsupported.js:2:14)
at Module._compile (node:internal/modules/cjs/loader:1246:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
at Module.load (node:internal/modules/cjs/loader:1103:32)
at Module._load (node:internal/modules/cjs/loader:942:12)
at Module.require (node:internal/modules/cjs/loader:1127:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/share/npm/lib/utils/unsupported.js',
'/usr/share/npm/bin/npm-cli.js'
]
}
Node.js v19.5.0
How can I fix that? After uninstalling nodejs and npm (and then reinstalling them) it still doesn't work.
OS: Deepin 23
I cant comment yet so im writing here. did you run the command npm install -g semver

npm cannot run evalmachine.<anonymous>

I got this problem for a while can't find any solution , please give me some explain.
C:\Users\ASUS ZenBook I5>npm -v
evalmachine.<anonymous>:27
const { Math, Object } = primordials;
^
ReferenceError: primordials is not defined
at evalmachine.<anonymous>:27:26
at Object.<anonymous> (C:\Users\ASUS ZenBook I5\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:8)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (C:\Users\ASUS ZenBook I5\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:959:30)
node.js
v12.13.1
Possible duplicate: npm ReferenceError: primordials is not defined (node.js)
The problem seems to be graceful-fs - maybe it's even enough to run the following?
npm cache clean --force
Uninstall node go to \AppData\Roaming\npm\node_modules\npm delete this npm folder, now install node nad that is all.

Error: Cannot find module 'react-dev-utils/WatchMissingNodeModulesPlugin'

I have React.js application with the connection of Rust. Problem is about running the application. When I try to run npm start it return this error:
throw err;
^
Error: Cannot find module 'react-dev-utils/WatchMissingNodeModulesPlugin'
Require stack:
- /Users/elchinfarhad/Desktop/IndoorNavigation/react-client/config/webpack.config.js
- /Users/elchinfarhad/Desktop/IndoorNavigation/react-client/scripts/start.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:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/elchinfarhad/Desktop/IndoorNavigation/react-client/config/webpack.config.js:19:39)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/elchinfarhad/Desktop/IndoorNavigation/react-client/config/webpack.config.js',
'/Users/elchinfarhad/Desktop/IndoorNavigation/react-client/scripts/start.js'
]
}
Point is it was working before and I did not change anything, but later when I try npm start it return the above error. I try to delete node_modules and package-lock.json and install again but nothing changes. Can someone please help how can I solve this problem.
I encountered the same problem. It is probably about your npm version. I downgraded my npm version to 6.14.11, and the problem was solved.
npm install -g npm#6.14.11

npm start (yarn start) error. cannot find #babel/register

I creact app using react. I usually use yarn start to run my app.
Error messege is "cannot find #babel/register" but there is on the package.json.
In my package.json
"#babel/register": "^7.6.2"
my index.js
require('#babel/register');
module.exports = require('./server.js');
Error
> reactjs-simple-boilerplate#1.0.0 start
> node src/server/index.js
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module '#babel/register'
Require stack:
- /Users/mk/kr/kr-application-bd786050/kr-site/src/server/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/Users/mk/kr/kr-application-bd786050/kr-site/src/server/index.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/mk/kr/kr-application-bd786050/kr-site/src/server/index.js'
]
}
npm install --save-dev #babel/register is not works for me.
After run this code, I got npm ERR! code EINTEGRITY
Not sure I can help 100% with the given information, but try running the following:
rm -rf node_modules package-lock.json yarn.lock; npm i
That will not only remove your modules, but it'll also remove eventual lock files which are used as conformity for your module versions; It could happen they mismatched versions between installations causing the above error, thus by removing and reinstalling you should solve the problem.
If that's not the case, you might have something off on your package.json, which you'd need to share in order to debug further

The problem with npm - internal/modules/cjs/loader.js:968

Good day!
I reinstalled Node.js to the latest version, from the Linux terminal and now npm gives the following error:
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'semver'
Require stack:
- /usr/local/lib/node_modules/npm/lib/utils/unsupported.js
- /usr/local/lib/node_modules/npm/bin/npm-cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/local/lib/node_modules/npm/lib/utils/unsupported.js',
'/usr/local/lib/node_modules/npm/bin/npm-cli.js'
]
}
How can you fix this?
try npm install semver or try to delete existing node_moudles folder and run npm install command

Resources