Webpack issue with npm start script with logs - npm

I have always problems with doing SAME stuff like in tuts but for them works fine, and for me is always issues. All is good configured but I've got errors
LOG:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm#5.6.0
3 info using node#v9.5.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle worldwide_ocean#1.0.0~prebuild: worldwide_ocean#1.0.0
6 info lifecycle worldwide_ocean#1.0.0~build: worldwide_ocean#1.0.0
7 verbose lifecycle worldwide_ocean#1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle worldwide_ocean#1.0.0~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/thetanadu/Dokumenty/codetemp/worldwide_ocean/node_modules/.bin:/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/thetanadu/Dokumenty/codetemp/worldwide_ocean/node_modules/.bin:/home/thetanadu/bin:/home/thetanadu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle worldwide_ocean#1.0.0~build: CWD: /home/thetanadu/Dokumenty/codetemp/worldwide_ocean
10 silly lifecycle worldwide_ocean#1.0.0~build: Args: [ '-c',
10 silly lifecycle 'webpack -d && webpack-dev-server -content-base src/ --inline --hot --port 1234' ]
11 silly lifecycle worldwide_ocean#1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle worldwide_ocean#1.0.0~build: Failed to exec build script
13 verbose stack Error: worldwide_ocean#1.0.0 build: `webpack -d && webpack-dev-server -content-base src/ --inline --hot --port 1234`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at EventEmitter.emit (events.js:160:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:160:13)
13 verbose stack at maybeClose (internal/child_process.js:943:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid worldwide_ocean#1.0.0
15 verbose cwd /home/thetanadu/Dokumenty/codetemp/worldwide_ocean
16 verbose Linux 4.13.0-32-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v9.5.0
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error worldwide_ocean#1.0.0 build: `webpack -d && webpack-dev-server -content-base src/ --inline --hot --port 1234`
22 error Exit status 1
23 error Failed at the worldwide_ocean#1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
package.json #scripts
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "npm run build",
"build": "webpack -d && webpack-dev-server -content-base src/ --inline --hot --port 1234"
}
Commands are 1:1 and for him is compiling, but not for me, I tried to look over this log but for me it isn't say anything clear :/

It depends on your dev scripts. IF you are using the webpack-dev-server then you could try these commands in your packages.json:
"scripts": {
"start": "start npm run start:client",
"start:client": "webpack-dev-server"
...
},
the build command could be called in you CLI - webpack -p or without -p

Related

vs code extension test script does not run and fail with npm ERR! code ELIFECYCLE

following are the version details
Version: 1.74.3 (user setup)
Commit: 97dec172d3256f8ca4bfb2143f3f76b503ca0534
Date: 2023-01-09T16:59:02.252Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.22000
Sandboxed: No
creating an extension and write test cases for common method file and when run with debug panel from activity bar ( which use launch.json) then it run and give test result also but when run below in terminal
npm run test
it failed with below output
D:\Developer\color-extension>npm run test
> my-extension#0.0.1 pretest D:\Developer\color-extension
> npm run compile && npm run lint
> my-extension#0.0.1 compile D:\Developer\color-extension
> tsc -p ./
> my-extension#0.0.1 lint D:\Developer\color-extension
> eslint src --ext ts
> my-extension#0.0.1 test D:\Developer\color-extension
> node ./out/test/runTest.js
Failed to run tests
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-extension#0.0.1 test: `node ./out/test/runTest.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-extension#0.0.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
and here is additional log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'test'
1 verbose cli ]
2 info using npm#6.14.15
3 info using node#v14.17.6
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle my-extension#0.0.1~pretest: my-extension#0.0.1
6 verbose lifecycle my-extension#0.0.1~pretest: unsafe-perm in lifecycle true
7 verbose lifecycle my-extension#0.0.1~pretest: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Developer\color-collector\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Users\User\AppData\Local\Microsoft\WindowsApps;C:\Users\User\AppData\Roaming\npm;C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\User\AppData\Local\GitHubDesktop\bin;C:\xampp\php;C:\Users\User\composer;C:\Users\User\AppData\Roaming\Composer\vendor\bin;C:\Program Files\Sublime Text\;;C:\Users\User\AppData\Local\Programs\oh-my-posh\bin
8 verbose lifecycle my-extension#0.0.1~pretest: CWD: D:\Developer\color-collector
9 silly lifecycle my-extension#0.0.1~pretest: Args: [ '/d /s /c', 'npm run compile && npm run lint' ]
10 silly lifecycle my-extension#0.0.1~pretest: Returned: code: 0 signal: null
11 info lifecycle my-extension#0.0.1~test: my-extension#0.0.1
12 verbose lifecycle my-extension#0.0.1~test: unsafe-perm in lifecycle true
13 verbose lifecycle my-extension#0.0.1~test: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Developer\color-collector\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Users\User\AppData\Local\Microsoft\WindowsApps;C:\Users\User\AppData\Roaming\npm;C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\User\AppData\Local\GitHubDesktop\bin;C:\xampp\php;C:\Users\User\composer;C:\Users\User\AppData\Roaming\Composer\vendor\bin;C:\Program Files\Sublime Text\;;C:\Users\User\AppData\Local\Programs\oh-my-posh\bin
14 verbose lifecycle my-extension#0.0.1~test: CWD: D:\Developer\color-collector
15 silly lifecycle my-extension#0.0.1~test: Args: [ '/d /s /c', 'node ./out/test/runTest.js' ]
16 silly lifecycle my-extension#0.0.1~test: Returned: code: 1 signal: null
17 info lifecycle my-extension#0.0.1~test: Failed to exec test script
18 verbose stack Error: my-extension#0.0.1 test: `node ./out/test/runTest.js`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
18 verbose stack at EventEmitter.emit (events.js:400:28)
18 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
18 verbose stack at ChildProcess.emit (events.js:400:28)
18 verbose stack at maybeClose (internal/child_process.js:1055:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
19 verbose pkgid my-extension#0.0.1
20 verbose cwd D:\Developer\color-collector
21 verbose Windows_NT 10.0.22000
22 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
23 verbose node v14.17.6
24 verbose npm v6.14.15
25 error code ELIFECYCLE
26 error errno 1
27 error my-extension#0.0.1 test: `node ./out/test/runTest.js`
27 error Exit status 1
28 error Failed at the my-extension#0.0.1 test script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]
package.json
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"coverage": "c8 --check-coverage npm run test"
},
"devDependencies": {
"#types/glob": "^8.0.0",
"#types/mocha": "^10.0.1",
"#types/node": "16.x",
"#types/vscode": "^1.74.0",
"#typescript-eslint/eslint-plugin": "^5.45.0",
"#typescript-eslint/parser": "^5.45.0",
"#vscode/test-electron": "^2.2.0",
"c8": "^7.12.0",
"eslint": "^8.28.0",
"glob": "^8.0.3",
"mocha": "^10.1.0",
"typescript": "^4.9.3"
}
what could be the issue here? As far as I see it run posttest script but there is no posttet script added in package.json, is that the reason because I have created this extension and the package.json generated by yo generator.
re run npm install and npm cache clean --force too but no benifit.
it was node version issue but not displaying in any error. when I delete the node_modules and do npm install again then it tell electron require v 16 and more so after updating the node version , able to execute the test command.

Webpack npm script cannot find command "src/index.js"

I am having trouble with webpack, or at-least I assume it is with webpack.
I have installed it using npm. I have been following the Mithril.js Simple App tutorial which says to do the following in my package.json
package.json
{
"name": "my-project",
"scripts": {
"start": "webpack src/index.js --output bin/app.js -d --watch"
}
}
I ran the following command in the root of my project directory which contains a src/ folder that has my index.js file. I also have a bin/ folder which will hold the output from the webpack command specified in my package.json file shown above.
npm install webpack webpack-cli
So I proceed to run:
npm start
Below is the error that I get at runtime. Something about not being able to find src/index.js which is there and not misspelled, I checked more than once.
Direct Terminal output:
user#ubunutu:~/Projects/mothersrfc/client$ ll
total 60
drwxrwxr-x 2 jreyes jreyes 4096 Jan 6 21:45 bin
drwxrwxr-x 97 jreyes jreyes 4096 Jan 6 21:09 node_modules
-rw-rw-r-- 1 jreyes jreyes 382 Jan 6 22:23 package.json
-rw-rw-r-- 1 jreyes jreyes 42984 Jan 6 21:09 package-lock.json
drwxrwxr-x 2 jreyes jreyes 4096 Jan 6 22:26 src
user#ubunutu:~/Projects/mothersrfc/client$ npm start
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/3527/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> mothersrfc-client#1.0.0 start /home/jreyes/Projects/mothersrfc/client
> webpack src/index.js --output bin/app.js -d --watch
[webpack-cli] Unknown command 'src/index.js'
[webpack-cli] Run 'webpack --help' to see available commands and options
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mothersrfc-client#1.0.0 start: `webpack src/index.js --output bin/app.js -d --watch`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the mothersrfc-client#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! /home/jreyes/.npm/_logs/2021-01-07T05_00_13_372Z-debug.log
user#ubunutu:~/Projects/mothersrfc/client$
and here is my error log from npm....
0 info it worked if it ends with ok
1 verbose cli [ '/snap/node/3527/bin/node', '/snap/node/3527/bin/npm', 'start' ]
2 info using npm#6.14.10
3 info using node#v14.15.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle mothersrfc-client#1.0.0~prestart: mothersrfc-client#1.0.0
6 info lifecycle mothersrfc-client#1.0.0~start: mothersrfc-client#1.0.0
7 warn lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/3527/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
8 verbose lifecycle mothersrfc-client#1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle mothersrfc-client#1.0.0~start: PATH: /snap/node/3527/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/jreyes/Projects/mothersrfc/client/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle mothersrfc-client#1.0.0~start: CWD: /home/jreyes/Projects/mothersrfc/client
11 silly lifecycle mothersrfc-client#1.0.0~start: Args: [ '-c', 'webpack src/index.js --output bin/app.js -d --watch' ]
12 silly lifecycle mothersrfc-client#1.0.0~start: Returned: code: 2 signal: null
13 info lifecycle mothersrfc-client#1.0.0~start: Failed to exec start script
14 verbose stack Error: mothersrfc-client#1.0.0 start: `webpack src/index.js --output bin/app.js -d --watch`
14 verbose stack Exit status 2
14 verbose stack at EventEmitter.<anonymous> (/snap/node/3527/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
14 verbose stack at EventEmitter.emit (events.js:315:20)
14 verbose stack at ChildProcess.<anonymous> (/snap/node/3527/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
14 verbose stack at ChildProcess.emit (events.js:315:20)
14 verbose stack at maybeClose (internal/child_process.js:1048:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
15 verbose pkgid mothersrfc-client#1.0.0
16 verbose cwd /home/jreyes/Projects/mothersrfc/client
17 verbose Linux 5.4.0-59-generic
18 verbose argv "/snap/node/3527/bin/node" "/snap/node/3527/bin/npm" "start"
19 verbose node v14.15.4
20 verbose npm v6.14.10
21 error code ELIFECYCLE
22 error errno 2
23 error mothersrfc-client#1.0.0 start: `webpack src/index.js --output bin/app.js -d --watch`
23 error Exit status 2
24 error Failed at the mothersrfc-client#1.0.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 2, true ]
Edit: I'm using webpack version 5.11.1 and webpack-cli version 4.3.1
You can do this:
package.json
// package.json
{
"name": "my-project",
"scripts": {
//"start": "webpack src/index.js --output bin/app.js -d --watch",
"build": "webpack --mode=production webpack.config.js",
"start": "webpack-dev-server --mode=development webpack.config.js"
}
}
webpack.config.js
const path = require("path")
module.exports = {
entry: path.join(__dirname, "./src/index.js"),
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist")
},
...
}
webpack-cli v4 changed how the entry points are parsed.
v3
webpack a.js b.js -o dist
v4
webpack --entry a.js --entry b.js -o dist

npm error code ELIFECYCLE when pressing CTRL+C

I've built a web scraping tool using mainly puppeteer for backend and inquirer.js for the CLI.
I want the end user to be able to exit the process without errors by pressing CTRL + C. This works perfectly when running node built/index.js, but when running npm start, pressing CTRL + C results in an error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jmtool#1.0.0 start: `node built/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jmtool#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\Andi\AppData\Roaming\npm-cache\_logs\2020-07-28T09_46_38_541Z-debug.log
Here's the full log file:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#6.4.1
3 info using node#v10.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle jmtool#1.0.0~prestart: jmtool#1.0.0
6 info lifecycle jmtool#1.0.0~start: jmtool#1.0.0
7 verbose lifecycle jmtool#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle jmtool#1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Andi\OneDrive - Fachhochschule Dortmund\Bachelorarbeit\jmtool\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\nodejs\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\Andi\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\;C:\Users\Andi\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Andi\AppData\Roaming\npm;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
9 verbose lifecycle jmtool#1.0.0~start: CWD: C:\Users\Andi\OneDrive - Fachhochschule Dortmund\Bachelorarbeit\jmtool
10 silly lifecycle jmtool#1.0.0~start: Args: [ '/d /s /c', 'node built/index.js' ]
11 silly lifecycle jmtool#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle jmtool#1.0.0~start: Failed to exec start script
13 verbose stack Error: jmtool#1.0.0 start: `node built/index.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid jmtool#1.0.0
15 verbose cwd C:\Users\Andi\OneDrive - Fachhochschule Dortmund\Bachelorarbeit\jmtool
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.15.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error jmtool#1.0.0 start: `node built/index.js`
22 error Exit status 1
23 error Failed at the jmtool#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
And here's my package.json:
{
"name": "jmtool",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node built/index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cheerio": "^1.0.0-rc.3",
"inquirer": "^7.3.2",
"inquirer-file-tree-selection-prompt": "^1.0.6",
"n-readlines": "^1.0.0",
"puppeteer": "^2.1.1",
"puppeteer-select": "^1.0.3",
"request": "^2.88.2"
},
"devDependencies": {
"#types/node": "^14.0.23"
}
}
Any ideas on how to fix this?
(I'm using Windows 10 64bit btw, in case that is relevant..)
I know the answer might be late, but I've just run into this issue. I think the problem is with the node version you're using. In my case, I was using node v12, changed the version to node v14.7.0 , and then I deleted node_modules rm -r node_modules, I run npm install, and then run npm start, and it worked for me.

NPM run watch exit status 3221226505

On my desktop when I run npm run watch everythign works as expected. However I'm setting up a new laptop and running into issues. I git pulled the latest version of what I'm working on to my laptop and ran npm install and then npm run watch and I get this error.
npm ERR! Exit status 3221226505
npm ERR!
npm ERR! Failed at the codefor.ca#1.0.0 watch 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\eslte\AppData\Roaming\npm-cache\_logs\2020-07-25T17_03_06_441Z-debug.log
I looked at the full log but I didn't see anything that explained the error to me.
Here's my package.json scripts
"scripts": {
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
}
recap
Works on desktop
fails on laptop
script is exactly the same on both
and the full log file
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'watch' ]
2 info using npm#6.7.0
3 info using node#v11.15.0
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle codefor.ca#1.0.0~prewatch: codefor.ca#1.0.0
6 info lifecycle codefor.ca#1.0.0~watch: codefor.ca#1.0.0
7 verbose lifecycle codefor.ca#1.0.0~watch: unsafe-perm in lifecycle true
8 verbose lifecycle codefor.ca#1.0.0~watch: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\sites\code-for-canada\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\eslte\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\windows\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Program Files (x86)\Common Files\Acronis\VirtualFile;C:\Program Files (x86)\Common Files\Acronis\VirtualFile64;C:\Program Files (x86)\Common Files\Acronis\SnapAPI;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\DDEV;C:\Program Files\nodejs;C:\Users\eslte\AppData\Local\Microsoft\WindowsApps;C:\Users\eslte\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\eslte\AppData\Roaming\npm
9 verbose lifecycle codefor.ca#1.0.0~watch: CWD: C:\sites\code-for-canada
10 silly lifecycle codefor.ca#1.0.0~watch: Args: [ '/d /s /c',
10 silly lifecycle 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle codefor.ca#1.0.0~watch: Returned: code: 3221226505 signal: null
12 info lifecycle codefor.ca#1.0.0~watch: Failed to exec watch script
13 verbose stack Error: codefor.ca#1.0.0 watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
13 verbose stack Exit status 3221226505
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:193:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:193:13)
13 verbose stack at maybeClose (internal/child_process.js:999:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid codefor.ca#1.0.0
15 verbose cwd C:\sites\code-for-canada
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
18 verbose node v11.15.0
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 3221226505
22 error codefor.ca#1.0.0 watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 3221226505
23 error Failed at the codefor.ca#1.0.0 watch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221226505, true ]
Please advise
This is crazy old, but I just had the same error (thanks Google). Adding this in case it helps anyone.
My issue was that I was running the wrong version of node.
nvm list shows which versions you have, and which you're currently using.
nvm use 16 will switch to node 16.0.0 (or whatever).
I had been trying on node 14, this switch made all the things work!

Why does usemin not accept --htmlmin option?

I'm building a distribution copy of a website using npm usemin with --htmlmin option.
Running script below from package.json and I expect to create 3 mini/ugly files in dist directory: index.html, aboutus.html & contactus.html.
All files contain links and scripts bounded by <!--build:css css/main.css-->...<--endbuild--> and <!--build:js js/main.js-->...<--endbuild-->
Script also expected to create a main.css and a main.js
Actual result is that script errors if I set index.html htmlmin:true.
If I set to false (other two files remain htmlmin:true) then it runs "successfully" creating mini/ugly aboutus.html & contactus.html in dist. However it does not create any main files at all.
script 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\"",
"clean": "rimraf dist",
"copyfonts": "copyfiles -f node_modules/font-awesome/fonts/* dist/fonts",
"imagemin": "imagemin img/* -o dist/img",
"usemin": "usemin contactus.html -d dist -- htmlmin -o dist/contactus.html && usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html && usemin index.html -d dist -o dist/index.html",
"build": "npm run clean && npm run copyfonts && npm run imagemin && npm run usemin"
},
Error log is
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.16.2
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle confusion#1.0.0~prebuild: confusion#1.0.0
6 info lifecycle confusion#1.0.0~build: confusion#1.0.0
7 verbose lifecycle confusion#1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle confusion#1.0.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\user\OneDrive\Chiff Chaff\JavaScript Projects\Coursera\FullStack\Bootstrap4\conFusion\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files (x86)\Brackets\command;C:\Program Files\Git\cmd;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\AppData\Roaming\npm;C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\user\AppData\Local\GitHubDesktop\bin;C:\Program Files\Git\cmd;
9 verbose lifecycle confusion#1.0.0~build: CWD: C:\Users\user\OneDrive\Chiff Chaff\JavaScript Projects\Coursera\FullStack\Bootstrap4\conFusion
10 silly lifecycle confusion#1.0.0~build: Args: [
10 silly lifecycle '/d /s /c',
10 silly lifecycle 'npm run clean && npm run copyfonts && npm run imagemin && npm run usemin'
10 silly lifecycle ]
11 silly lifecycle confusion#1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle confusion#1.0.0~build: Failed to exec build script
13 verbose stack Error: confusion#1.0.0 build: `npm run clean && npm run copyfonts && npm run imagemin && npm run usemin`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:310:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:310:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid confusion#1.0.0
15 verbose cwd C:\Users\user\OneDrive\Chiff Chaff\JavaScript Projects\Coursera\FullStack\Bootstrap4\conFusion
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v12.16.2
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error confusion#1.0.0 build: `npm run clean && npm run copyfonts && npm run imagemin && npm run usemin`
22 error Exit status 1
23 error Failed at the confusion#1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Check you CSS and JavaScript source file path
I had the same problem recently. I figured out that there is a wrong path (JavaScript files) in my about.html file
Here the wrong path,
<script src="node_modules/popper.js/dist/popper.min.js"></script>
I correct it to,
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
Because I write the wrong source path, this is why my aboutus.html file couldn't be minified. Though its render CSS/main.css file. When it comes to JavaScript block, it stopped. Then the whole process became stoped.
Here is my CSS and JavaScript source file path
<!-- build:css css/main.css -->
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="node_modules/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="node_modules/bootstrap-social/bootstrap-social.css">
<link rel="stylesheet" href="css/styles.css">
<!-- endbuild -->
<!-- build:js js/main.js -->
<script src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="js/script.js"></script>
<!-- endbuild -->