Issue with npm start command - node.js

While setting the environment for the Vue.js app I have encountered the issue with npm start related to node_modules and nodemon.
I am getting this error in the console when running the $npm start command:
$ npm start
> server#1.0.0 start C:\Users\Michał\desktop\it\vueapptrain\server
> node .node_modules/nodemon/.bin/nodemon.js src/app.js --exec 'npm run lint && node'
module.js:515
throw err;
^
Error: Cannot find module 'C:\Users\Michał\desktop\it\vueapptrain\server\.node_modules\nodemon\.bin\nodemon.js'
at Function.Module._resolveFilename (module.js:513:15)
at Function.Module._load (module.js:463:25)
at Function.Module.runMain (module.js:653:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server#1.0.0 start: `node .node_modules/nodemon/.bin/nodemon.js src/app.js --exec 'npm run lint && node'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Any ideas how this can be solved?

Firstly, ensure you have nodemon installed; npm i nodemon -S.
Then, edit the start script in your package.json to this,
node ./node_modules/.bin/nodemon src/app.js --exec 'npm run lint && node'

Related

framework7 stuck at executing npm scripts and start npm throws a bunch of errors

i am new to the framework and was just going through a tutorial and encountered by an error after pressing create app in the local host
Generating package.json
✔ Creating required folders structure
✔ Installing NPM Dependencies
✔ Installing NPM Dev Dependencies
Executing NPM Scripts
this happens its stuck at executing NPM scripts waited a whole 3 hours still executing
The start npm command shows the following:-
> whatchat#1.0.0 start C:\Users\piyush\whatchat
> npm run dev
> whatchat#1.0.0 dev C:\Users\piyush\whatchat
> cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js
internal/modules/cjs/loader.js:1032
throw err;
^
Error: Cannot find module 'C:\Users\piyush\whatchat\build\webpack.config.js'
Require stack:
- C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js
- C:\Users\piyush\whatchat\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at WEBPACK_OPTIONS (C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js:114:13)
at requireConfig (C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js:116:6)
at C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js:123:17
at Array.forEach (<anonymous>)
at module.exports (C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js:121:15)
at Object.<anonymous> (C:\Users\piyush\whatchat\node_modules\webpack-dev-server\bin\webpack-dev-server.js:84:40) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\piyush\\whatchat\\node_modules\\webpack-cli\\bin\\utils\\convert-argv.js',
'C:\\Users\\piyush\\whatchat\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! whatchat#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the whatchat#1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\piyush\AppData\Roaming\npm-cache\_logs\2020-12-15T14_13_28_671Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! whatchat#1.0.0 start: `npm run dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the whatchat#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\piyush\AppData\Roaming\npm-cache\_logs\2020-12-15T14_13_28_828Z-debug.log
i searched lot on Google and discord coding help servers but could not fix this please help me out
you probably didn't install cordova before try:
npm install -g cordova

How to fix cross-env issue when running "npm run dev" for vue-cli

When I run npm run dev, I can not get the local IP properly.
Error: listen EFAULT: bad address in system call argument 0.0.0.0:8081
I do.
1. delete the "cross-env" folder and the "cross-spawn" folder under the node_modules
2. run npm install
3. run npm run dev
4. the error ip changes as follows.
Error: listen EFAULT: bad address in system call argument 10.0.75.1:8081
the ip address is vEthernet for the docker.
PS E:\WorkSpace\my-project> npm run dev
> my-project#1.0.0 dev E:\WorkSpace\my-project
> cross-env NODE_ENV=development webpack-dev-server --open --hot
E:\WorkSpace\my-project\node_modules\webpack-dev-server\bin\webpack-dev-server.js:356
if (err) throw err;
^
Error: listen EFAULT: bad address in system call argument 10.0.75.1:8081
at Server.setupListenHandle [as _listen2] (net.js:1279:14)
at listenInCluster (net.js:1327:12)
at doListen (net.js:1460:7)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-project#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-project#1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\LG\AppData\Roaming\npm-cache\_logs\2019-06-11T13_23_46_070Z-debug.lo
What if you try this:
yarn remove webpack-dev-server
yarn add webpack-dev-server#2.9.1 --dev
yarn run dev
or using npm instead yarn

any solution for the following error that appeared after installing onchange and parallelshell node_modules?

after installing the onchange and parallelshell packages for node.js by typing the following command in the node terminal
npm install --save-dev onchange#3.3.0 parallelshell#3.0.2
and configure the package.json file as follow to be able to use the two scripts
"scripts": {
"start": "npm run watch:all",
"test": "echo \"Error: no test specified\" && exit 1",
"lite": "lite-server",
"scss": "node-sass -o css/ css/",
"watch:scss": "onchange \"css/*.scss\" --npm run scss",
"watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\""
}
and when typing 'npm start' to run, i face the following error and cannot solve it. so help me if u can please!
The Error :
confusion#1.0.0 start D:\programming materials\coursera courses\web and mobile dev specialization\course 1\module 1\bootstrap exercise\assignment 1\Bootstrap4\conFusion
npm run watch:all
confusion#1.0.0 watch:all D:\programming materials\coursera courses\web and mobile dev specialization\course 1\module 1\bootstrap exercise\assignment 1\Bootstrap4\conFusion
parallelshell "npm run watch:scss" "npm run lite"
child_process.js:420
throw new ERR_INVALID_ARG_TYPE('options.cwd', 'string', options.cwd);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "options.cwd" property must be of type string. Received type function
at normalizeSpawnArguments (child_process.js:420:11)
at spawn (child_process.js:522:38)
at D:\programming materials\coursera courses\web and mobile dev specialization\course 1\module 1\bootstrap exercise\assignment 1\Bootstrap4\conFusion\node_modules\parallelshell\index.js:104:17
at Array.forEach ()
at Object. (D:\programming materials\coursera courses\web and mobile dev specialization\course 1\module 1\bootstrap exercise\assignment 1\Bootstrap4\conFusion\node_modules\parallelshell\index.js:100:6)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! confusion#1.0.0 watch:all: parallelshell "npm run watch:scss" "npm run lite"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the confusion#1.0.0 watch:all script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MISR COMP\AppData\Roaming\npm-cache_logs\2018-07-30T15_48_55_679Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! confusion#1.0.0 start: npm run watch:all
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the confusion#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MISR COMP\AppData\Roaming\npm-cache_logs\2018-07-30T15_48_55_778Z-debug.log
I have had the same problem as you. We are probably doing the same course. Apparently, is a problem with version 3.0.2 of parallelshell. You just have to downgrade to version 3.0.1 and you will not have any more problems:
npm install --save-dev parallelshell#3.0.1
Downgrade the version of parallelshell to 3.0.1 by typing
npm install --save-dev parallelshell#3.0.1
Then type
npm start
And it works!!
Apparently we are doing the same course. So follow the below-mentioned way--
To install two NPM packages onchange and parallelshell use the downgraded version of parallel shell instead of 3.0.2 us 3.0.1:
npm install --save-dev onchange#3.3.0 parallelshell#3.0.1
give space between -- and npm
"watch:scss":"onchange \"css/*.scss\" -- npm run scss"
this will end first error
for parallelshell problem
do this copy content of index.js file from given link
https://raw.githubusercontent.com/darkguy2008/parallelshell/master/index.js
and paste it in your index.file at /project/node_modules/parallelshell/index.js
this will work.
First Un-Install all versions of parallelshell.
npm uninstall --save-dev parallelshell
Second Install parallelshell#3.0.1:
npm install --save-dev parallelshell#3.0.1
Third run start:
npm run start

npm start not working for my react project

So I'm trying to run the npm start on a react project I made in command line so that I can run the browser sync and see my progress as I work on it.
However, I keep getting this result whenever I try to run it.
module.js:538
throw err;
^
Error: Cannot find module '/Users/Sam/Library/Mobile Documents/com~apple~CloudDocs/Work/BookStore/Home attempts/Routing/2-react-router/lib/server.js'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-tutorials#0.0.0 start: `node lib/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-tutorials#0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Sam/.npm/_logs/2017-11-30T20_10_07_869Z-debug.log
I'm not sure what's going on as I'm not an expert on react/node/npm, rather a reluctant amateur.
Can anyone help?
When you execute npm start, a command node lib/server.js is called. Command is defined in package.json
"scripts": {
"start": "node lib/server.js"
}
Looking from the error post it looks that server.js file is missing in lib folder.

SyntaxError: missing ) after argument list | nodejs | `npm start`

Running npm start is giving me a syntax error, shown in the output below.
I know how to fix a simple syntax error but I doubt that's the issue here. Looking through various forums didn't result in an answer for me.
[nodemon] starting `npm run lint && node src/app.js`
> server#1.0.0 lint C:\Users\brend\project\server
> node ./node_modules/.bin/eslint **/*.js
C:\Users\brend\project\server\node_modules\.bin\eslint:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
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)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\ProgramFiles\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "lint"
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! server#1.0.0 lint: `node ./node_modules/.bin/eslint **/*.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server#1.0.0 lint script 'node ./node_modules/.bin/eslint **/*.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./node_modules/.bin/eslint **/*.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls server
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\brend\project\server\npm-debug.log
[nodemon] app crashed - waiting for file changes before starting...
Below is the package.json.
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node ./node_modules/nodemon/bin/nodemon.js src/app.js --exec \"npm run lint && node\" ",
"lint": "node ./node_modules/.bin/eslint **/*.js"
},
Ugh.. Okay first thing I ran into was an error saying that '.' is not recognized as an internal or external command. I googled and came to the conclusion that I needed to put node before the script. This resulted in progress; namely that it actually ran the script. Turns out it was needed at the "start" script but not the "lint" script.
My package.json scripts now look like this:
"scripts": {
"start": "node ./node_modules/nodemon/bin/nodemon.js src/app.js --exec \"npm run lint && node\" ",
"lint": "./node_modules/.bin/eslint **/*.js"
},
Which results in:
[nodemon] starting `npm run lint && node src/app.js`
> server#1.0.0 lint C:\Users\brend\project\server
> eslint **/*.js
hello
[nodemon] clean exit - waiting for changes before restart
ps: Thank you for your help kind strangers!

Resources