Error while executing "npm start" command - npm

I installed npm and changed the package.json file so that it can automatically compile the .scss file into a css file when npm start is used. the changes made are as follows.
"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\""
},
but when I run the "npm start" command it returns an error. The error is as follows.
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\DJ\AppData\Roaming\npm-cache\_logs\2020-07-16T15_52_00_182Z-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\DJ\AppData\Roaming\npm-cache\_logs\2020-07-16T15_52_00_229Z-debug.log
please help me solve this problem,
I want to complete my project but this error is in my way.

It is a bug from parallelshell. We will have to manually edit file to fix this error
You need to go to the file:
node_modules/parallelshell/index.js:105
Then change this line:
cwd: process.versions.node < '8.0.0' ? process.cwd : process.cwd(),
To this:
cwd: parseInt(process.versions.node) < 8 ? process.cwd : process.cwd()
Then things will work well

Related

NPM Parallelshell not working, showing error

I was trying to run npm lite server and onchange for scss together as described in my course but instead got an error...
Tried Running npm start with package.json containing script as -
"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\""
}
Instead of working properly, I got the following error -
> confusion#1.0.0 start F:\Courses\Full-Stack Web Development\Bootstrap4\conFusion
> npm run watch:all
> confusion#1.0.0 watch:all F:\Courses\Full-Stack Web Development\Bootstrap4\conFusion
> parallelshell "npm run watch:scss" "npm run lite"
child_process.js:430
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 function wrappedCwd
at normalizeSpawnArguments (child_process.js:430:11)
at spawn (child_process.js:546:13)
at F:\Courses\Full-Stack Web Development\Bootstrap4\conFusion\node_modules\parallelshell\index.js:104:17
at Array.forEach (<anonymous>)
at Object.<anonymous> (F:\Courses\Full-Stack Web Development\Bootstrap4\conFusion\node_modules\parallelshell\index.js:100:6)
at Module._compile (internal/modules/cjs/loader.js:1176:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
at Module.load (internal/modules/cjs/loader.js:1040:32)
at Function.Module._load (internal/modules/cjs/loader.js:929:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'ERR_INVALID_ARG_TYPE'
}
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\Ankur\AppData\Roaming\npm-cache\_logs\2020-05-27T07_16_54_990Z-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\Ankur\AppData\Roaming\npm-cache\_logs\2020-05-27T07_16_55_176Z-debug.log
How to remove this error..?
While searching for a solution I found the solution for this problem on another post -
Problem running parallelshell Nodejs script
go to the file:
node_modules/parallelshell/index.js:105
Then change this line:
cwd: process.versions.node < '8.0.0' ? process.cwd : process.cwd(),
To this:
cwd: parseInt(process.versions.node) < 8 ? process.cwd : process.cwd(),

`npm start` failed after `npm run eject`

Command start unrecognized. Make sure that you have run npm install and that you are inside a react-native project.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: react-native start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # 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\Ishan\AppData\Roaming\npm-cache_logs\2019-02-24T11_24_50_101Z-debug.log
You are missing a start script in your package.json
Your package.json must have a start script like so -
{
"scripts": {
"start": "react-native-scripts start"
}
}

In Vue-CLI run dev, fail.

In the vue-cli, I want to npm run dev, but get the bellow error:
$ npm run dev
> vuejs-playlist#1.0.0 dev /Users/den/Desktop/Test/vue/vuejs-playlist
> cross-env NODE_ENV=development webpack-dev-server --open --hot
sh: cross-env: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! vuejs-playlist#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the vuejs-playlist#1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/den/.npm/_logs/2018-02-02T11_54_11_067Z-debug.log
Try as follows for #vue/cli
npm run serve
In your traceback:
Local package.json exists, but node_modules missing, did you mean to install?
You should in your project root directory install the dependencies:
npm install
Or use its logogram npm i
As both answers before stated your build failed due needing to first:
npm install
Once that is complete, check your package.json file.
In there will have the default options for npm run followed by your build script option.
Example:
{
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
}
}
Resulting in your npm run serve is the same as vue-cli-service serve
Reference: Vue Docs

Bootstrap4-NPM start error

I am learning to automate web development tasks using npm scripts.
Below is my package.json:
{
"name": "confusion",
"version": "1.0.0",
"description": "This is a website for Ristorante Con Fusion",
"main": "index.html",
"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'"
},
"author": "",
"license": "ISC",
"devDependencies": {
"lite-server": "^2.2.2",
"node-sass": "^4.7.2",
"onchange": "^3.3.0",
"parallelshell": "^3.0.2"
},
"dependencies": {
"bootstrap": "^4.0.0-alpha.6",
"font-awesome": "^4.7.0"
}
}
However, when I run npm start in the command prompt I encounter the following error:
Error message:
D:\encypher technologies\Bootstrap4-starter\Bootstrap4\conFusion>npm start
confusion#1.0.0 start D:\encypher technologies\Bootstrap4-starter\Bootstrap4\conFusion
npm run watch:all
confusion#1.0.0 watch:all D:\encypher technologies\Bootstrap4-starter\Bootstrap4\conFusion
parallelshell 'npm run watch:scss' 'npm run lite'
'npm' is not recognized as an internal or external command, operable program or batch file.
'run' is not recognized as an internal or external command, operable program or batch file.
The filename, directory name, or volume label syntax is incorrect.
'npm' is not recognized as an internal or external command,
operable program or batch file.
'run' is not recognized as an internal or external command, operable program or batch file.
'lite'' is not recognized as an internal or external command, operable program or batch file.
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\NIKHIL\AppData\Roaming\npm-cache\_log\2018-01-08T11_13_45_703Z-debug.log
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\NIKHIL\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v8.9.3
npm ERR! npm v2.15.12
npm ERR! code ELIFECYCLE
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 run watch:all'.
npm ERR! This is most likely a problem with the confusion package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run watch:all
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs confusion
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls confusion
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! D:\encypher technologies\Bootstrap4-starter\Bootstrap4\conFusion\npm-debug.log
I guess you are using Windows. The Windows command line doesn't like single quotes in package.json. Use \" instead.
"watch:scss": "onchange \"css/*.scss\" -- npm run scss",
"watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\""
You were also missing the space between -- and npm.

Unable to start app with npm start

I have followed the instructions in https://angular.io/guide/quickstart and created the corresponding quickstart files and installed dependencies using npm install command. After that when I issue npm start command I am getting the following error.
npm ERR! Linux 3.13.0-32-generic
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.10.25
npm ERR! npm v3.9.0
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart#1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular2-quickstart#1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
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 angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tsc && concurrently "npm run tsc:w" "npm run lite"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/sobin/AngularTuts/heroappbase/npm-debug.log
First, I tried just running this command in the command prompt:
concurrently "npm run tsc:w" "npm run lite"
That worked. Then, in the package.json file, I replaced this line:
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
With this:
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
At that point, npm start worked normally. Hope that helps.
According to their docs, angular2 requires at least node 5.x.x
From their site:
Verify that you are running at least node v5.x.x and npm 3.x.x by running node -v and npm -v in a terminal/console window. Older versions produce errors.
Looks like you are running node v0.10.25. Try upgrading.
To upgrade, you can use nvm which lets you switch easily between the versions. nvm on GitHub.