NPM Parallelshell not working, showing error - npm

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(),

Related

Unable to "npm install"

Please could I ask for help with the following:
I have cloned the Electron starter app like so:
git clone https://github.com/electron/electron-quick-start
And have it running.
I am working from the terminal window is VSCode.
I am using node version 6.13.4
Can type "npm start" and all is good, app runs fine.
Now, I want to use a certain package for working with zip files, so I try the following:
npm install decompress-zip
The result is ultimately an error, here's the output:
PS C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip> npm install decompress-zip
> electron#16.0.5 postinstall C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip\node_modules\electron
> node install.js
RequestError: self signed certificate in certificate chain
at ClientRequest.<anonymous> (C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip\node_modules\got\source\request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:428:26)
at ClientRequest.emit (events.js:333:22)
at ClientRequest.origin.emit (C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip\node_modules\#szmarczak\http-timer\source\index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:321:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
npm WARN rollback Rolling back debug#2.6.9 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip\node_modules\extract-zip\node_modules'npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron#16.0.5 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron#16.0.5 postinstall 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\105043131\AppData\Roaming\npm-cache\_logs\2022-01-05T11_15_47_499Z-debug.log
Now the build is broken. If try again "npm start" then I get:
PS C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip> npm
start
electron-quick-start#1.0.0 start C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip
electron .
internal/modules/cjs/loader.js:984 throw err; ^
Error: Cannot find module 'C:\Work\Electron
Apps\electron-quick-start-added-fs-and-zip\node_modules\electron\cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:981:15)
at Function.Module._load (internal/modules/cjs/loader.js:863:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } npm ERR! code ELIFECYCLE npm
ERR! errno 1 npm ERR! electron-quick-start#1.0.0 start: electron .
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the
electron-quick-start#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\105043131\AppData\Roaming\npm-cache_logs\2022-01-05T11_18_31_473Z-debug.log
Makes no difference now if I run "npm uninstall decompress-zip", I still get the same error when I try "npm start".
This line from the above caught my eye:
npm ERR! Failed at the electron#16.0.5
If I start completely over an try installing another package instead like so:
npm install yauzl
I get similar errors including the line:
npm ERR! Failed at the electron#16.0.5 postinstall script.
I currently have electron 8.1.1 installed
Could it be that these packages require electron 16?
Or is it something else?
If it is the former, would anyone know of a solution for unzipping a disk file using an older version of electron?
Thanks for any help.
the best way is to update Node.js. Uninstall old version then go to https://nodejs.org/en/download/ and download LTC version

Error while executing "npm start" command

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

`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"
}
}

How do I solve "Cannot find module" error

I want to build a website using React witht he help of npm and webpack. I have installed npm in my machine and now I am trying to install webpack in my machine.
I ran the following command:
npm i webpack -S
but then it throws error. Please find the error log below:
npm http 200 https://registry.npmjs.org/is-buffer
npm http GET https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz
npm http 200 https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz
> uglifyjs-webpack-plugin#0.4.6 postinstall /usr/local/litle-home/tkale/cvs/scurvyReact/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
module.js:340
throw err;
^
Error: Cannot find module 'sync-exec'
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> (/usr/local/litle-home/tkale/cvs/scurvyReact/node_modules/webpack/node_modules/uglifyjs-webpack-plugin/lib/post_install.js:9:14)
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 Function.Module.runMain (module.js:497:10)
npm ERR! weird error 8
npm ERR! Error: ENOENT, open '/usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423156518-0.5044926188420504/package/fp/wrapperValue.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 2.6.32-696.10.2.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "i" "webpack" "-S"
npm ERR! cwd /usr/local/litle-home/tkale/cvs/scurvyReact
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! path /usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423156518-0.5044926188420504/package/fp/wrapperValue.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! tar pack Error reading /usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423163147-0.8487295310478657/package
npm ERR! addLocalDirectory Could not pack "/usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423163147-0.8487295310478657/package" to "/usr/local/litle-home/tkale/.npm/es5-ext/0.10.35/package.tgz"
npm ERR! Error: ENOENT, lstat '/usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423153445-0.9213839254807681/package/node_modules/ajv/dist/regenerator.min.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 2.6.32-696.10.2.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "i" "webpack" "-S"
npm ERR! cwd /usr/local/litle-home/tkale/cvs/scurvyReact
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! path /usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423153445-0.9213839254807681/package/node_modules/ajv/dist/regenerator.min.js
npm ERR! fstream_path /usr/local/litle-home/tkale/tmp/npm-1220-UQjjVtpG/1508423153445-0.9213839254807681/package/node_modules/ajv/dist/regenerator.min.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/local/litle-home/tkale/cvs/scurvyReact/npm-debug.log
npm ERR! not ok code 0
Incase it helps, also find package.json file below:
{
"name": "React",
"version": "1.0.0",
"description": "Building website using React with help of npm and webpack",
"main": "index.js",
"scripts": {
"test": "karma start",
"start": "node server.js",
"_comment": "start in the above line tells heroku how to start our app"
},
"author": "Tushar",
"license": "XYZ"
}
Could you please help me solve this issue.
If I read the error correctly, you seem to be using a really old version of node and npm. Try updating those to the LTS or even the latest release.
You can get the latest versions and/or installation instructions here.

GIT Bash, npm start error

i am getting the following error on npm start command,
angular-quickstart#1.0.0 prestart C:\Project\myapp
npm run build
angular-quickstart#1.0.0 build C:\Project\myapp
tsc -p src/
angular-quickstart#1.0.0 start C:\Project\myapp
concurrently "npm run build:watch" "npm run serve"
Error occured when executing command: npm run build:watch
Error: Unable to detect platform shell type. Please set SHELL_EXECUTE_FLAG env variable.
at detectExecuteFlag (C:\Project\myapp\node_modules\spawn-default-shell\src\get-shell.js:29:9)
at getShell (C:\Project\myapp\node_modules\spawn-default-shell\src\get-shell.js:37:18)
at Object.spawn (C:\Project\myapp\node_modules\spawn-default-shell\src\index.js:5:24)
at C:\Project\myapp\node_modules\concurrently\src\main.js:192:34
at arrayMap (C:\Project\myapp\node_modules\lodash\lodash.js:660:23)
at Function.map (C:\Project\myapp\node_modules\lodash\lodash.js:9571:14)
at run (C:\Project\myapp\node_modules\concurrently\src\main.js:181:22)
at main (C:\Project\myapp\node_modules\concurrently\src\main.js:61:5)
at Object. (C:\Project\myapp\node_modules\concurrently\src\main.js:421:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:418:7)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart#1.0.0 start: concurrently "npm run build:watch" "npm run serve"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart#1.0.0 start script 'concurrently "npm run build:watch" "npm run serve"'.
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 angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! concurrently "npm run build:watch" "npm run serve"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Project\myapp\npm-debug.log
Try to update your nodejs refer to these answers:
How do I update node and npm on windows?
If the error still persist use this link:
'concurently' is not recognized as an internal or external command, operable program or batch file