I'm very new to Node.js and Electron and wanted to run npm run build. Unfortunately, that only gives me out the error code ELIFECYCLE.
Here is my package.json:
{
"name": "firstelectronproject",
"version": "0.1.0",
"description": "My first Electron project",
"main": "main.js",
"scripts": {
"start": "electron index.js",
"package": "",
"build": "electron-packager . FEP"
},
"author": "F9lke <florian.thomasgoetzrath.de>",
"license": "MIT",
"dependencies": {
"electron": "^1.6.11"
},
"devDependencies": {
"asar": "^0.13.0",
"electron-packager": "^8.7.2"
}
}
Here is the log of my command prompt:
D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP>npm run build
> firstelectronproject#0.1.0 build D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP
> electron-packager . FEP
Packaging app for platform win32 x64 using electron v1.6.11
Command failed: npm prune --production
npm WARN invalid config loglevel="notice"
npm WARN firstelectronproject#0.1.0 No repository field.
npm ERR! May not delete: C:\Users\User\AppData\Local\Temp\electron-packager\win32-x64\FEP-win32-x64\resources\app\node_modules\.bin
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache\_logs\2017-07-21T11_38_37_230Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! firstelectronproject#0.1.0 build: `electron-packager . FEP`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the firstelectronproject#0.1.0 build 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\User\AppData\Roaming\npm-cache\_logs\2017-07-21T11_38_37_293Z-debug.log
And here is the log output:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm#5.3.0
3 info using node#v6.11.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle firstelectronproject#0.1.0~prebuild: firstelectronproject#0.1.0
6 info lifecycle firstelectronproject#0.1.0~build: firstelectronproject#0.1.0
7 verbose lifecycle firstelectronproject#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle firstelectronproject#0.1.0~build: PATH: C:\Users\User\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP\node_modules\.bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;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 (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Brackets\command;C:\Program Files\nodejs\;C:\Users\User\AppData\Local\Microsoft\WindowsApps;C:\Users\User\AppData\Local\atom\bin;C:\Users\User\AppData\Roaming\npm
9 verbose lifecycle firstelectronproject#0.1.0~build: CWD: D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP
10 silly lifecycle firstelectronproject#0.1.0~build: Args: [ '/d /s /c', 'electron-packager . FEP' ]
11 silly lifecycle firstelectronproject#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle firstelectronproject#0.1.0~build: Failed to exec build script
13 verbose stack Error: firstelectronproject#0.1.0 build: `electron-packager . FEP`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:289:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at EventEmitter.emit (events.js:191:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:891:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid firstelectronproject#0.1.0
15 verbose cwd D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP
16 verbose Windows_NT 10.0.15063
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v6.11.1
19 verbose npm v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error firstelectronproject#0.1.0 build: `electron-packager . FEP`
22 error Exit status 1
23 error Failed at the firstelectronproject#0.1.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 ]
This seems to be related to a bug in electron-packager. As a workaround you could downgrade electron-packager to e.g. ^7.7.0. Also, you need to update the build command slightly, see below (Note, only showing the relevant parts):
{
"scripts": {
"build": "electron-packager ./ --platform=linux --arch=x64"
},
"dependencies": {
"electron": "^1.6.11"
},
"devDependencies": {
"electron-packager": "^7.7.0"
}
}
Note that you can use --all to build for all platforms.
Updating npm on server worked for me.
I solved this problem by installing the array unique and it started working:
npm install --save array-unique
I encountered a similar problem with electron-packager. Just added ./ --all to the end of the pack directive. Final result given below:
"pack": "electron-packager ./ --all"
Related
I am having a problem running my system on my local server.
I tried running npm install then npm run start then I start getting this error :
Failed to compile
./src/app/App.js
Module not found: Can't resolve 'assets/css/style.css' in '/Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console/src/app'
I tried npm install npm run build then I get the following error :
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! console2#0.1.0 build: `npm run build-css && react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the console2#0.1.0 build 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/av/.npm/_logs/2021-09-27T13_40_54_796Z-debug.log
I checked the logged file and I found this :
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm#6.14.15
3 info using node#v14.17.6
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle console2#0.1.0~prebuild: console2#0.1.0
6 info lifecycle console2#0.1.0~build: console2#0.1.0
7 verbose lifecycle console2#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle console2#0.1.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle console2#0.1.0~build: CWD: /Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console
10 silly lifecycle console2#0.1.0~build: Args: [ '-c', 'npm run build-css && react-scripts build' ]
11 silly lifecycle console2#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle console2#0.1.0~build: Failed to exec build script
13 verbose stack Error: console2#0.1.0 build: `npm run build-css && react-scripts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid console2#0.1.0
15 verbose cwd /Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console
16 verbose Darwin 18.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v14.17.6
19 verbose npm v6.14.15
20 error code ELIFECYCLE
21 error errno 1
22 error console2#0.1.0 build: `npm run build-css && react-scripts build`
22 error Exit status 1
23 error Failed at the console2#0.1.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 ]
I tried the following steps but I'm getting the same error :
npm cache clean --force
delete node_modules folder
delete package-lock.json file
sudo npm install npm#latest -g this will upgrade npm to latest version
npm audit fix --force
npm upgrade --force
npm install
should assets/css/style.css be ../assets/css/style.css or some other relative path depending on what file it is in?
I have tried npm clear cache --force, removing node_modules/ and package-lock.json and then again npm install and then npm build and finally npm run dev. But unfortunately this failed around 5-6 times.
My Errors:
npm ERR! errno 1
npm ERR! with-redux-toolkit#1.0.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the with-redux-toolkit#1.0.0 build 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\divya\AppData\Roaming\npm-cache\_logs\2021-08-25T14_05_46_415Z-debug.log
My debug logs:
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-script',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm#6.14.14
3 info using node#v14.17.4
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle with-redux-toolkit#1.0.0~prebuild: with-redux-toolkit#1.0.0
6 info lifecycle with-redux-toolkit#1.0.0~build: with-redux-toolkit#1.0.0
7 verbose lifecycle with-redux-toolkit#1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle with-redux-toolkit#1.0.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;M:\Amazon-starter-template-nextjs\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\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\divya\AppData\Local\Programs\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin;C:\Users\divya\AppData\Local\Microsoft\WindowsApps;;C:\Users\divya\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\divya\AppData\Roaming\npm
9 verbose lifecycle with-redux-toolkit#1.0.0~build: CWD: M:\Amazon-starter-template-nextjs
10 silly lifecycle with-redux-toolkit#1.0.0~build: Args: [ '/d /s /c', 'next build' ]
11 silly lifecycle with-redux-toolkit#1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle with-redux-toolkit#1.0.0~build: Failed to exec build script
13 verbose stack Error: with-redux-toolkit#1.0.0 build: `next build`
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:400:28)
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:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid with-redux-toolkit#1.0.0
15 verbose cwd M:\Amazon-starter-template-nextjs
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "build"
18 verbose node v14.17.4
19 verbose npm v6.14.14
20 error code ELIFECYCLE
21 error errno 1
22 error with-redux-toolkit#1.0.0 build: `next build`
22 error Exit status 1
23 error Failed at the with-redux-toolkit#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 ]
My package.json file:
{
"name": "with-redux-toolkit",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#heroicons/react": "^1.0.4",
"#reduxjs/toolkit": "1.5.0",
"#tailwindcss/line-clamp": "^0.2.0",
"firebase": "^8.6.1",
"firebase-admin": "^9.8.0",
"heroicons-react": "^1.4.1",
"hoist-non-react-statics": "^3.3.2",
"next": "^11.1.0",
"next-fonts": "^1.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "7.2.2"
},
"license": "MIT",
"devDependencies": {
"autoprefixer": "^10.2.5",
"postcss": "^8.2.15",
"tailwindcss": "^2.2.7"
}
}
As the error says itself, this is not a problem with NPM. Only we have to do is
instead of,
npm run build -prod
extend the javascript memory by following,
node --max_old_space_size=4096 node_modules/#angular/cli/bin/ng build --prod
npm install --cache /tmp/empty-cache
npm run build
(I tried cache clean but not work)
I am getting the error below:
=== Deploying to 'nompu-website'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
functions# lint /home/superlelo/Desktop/publishToday/functions
eslint .
sh: 1: eslint: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! functions# lint: eslint .
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the functions# lint 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/superlelo/.npm/_logs/2019-09-24T15_05_43_357Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code126
When I run the command: firebase deploy --only functions. I get the same error when I am with or without admin privileges.
My package.json file looks like this:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"build":"npm run build",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
},
"dependencies": {
"firebase-admin": "^8.0.0",
"firebase-functions": "^3.1.0"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-plugin-promise": "^4.0.1",
"firebase-functions-test": "^0.1.6"
},
"private": true
}
Here is the complete log file:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli '--prefix',
1 verbose cli '/home/superlelo/Desktop/publishToday/functions',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using npm#6.9.0
3 info using node#v10.16.3
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle functions#~prelint: functions#
6 info lifecycle functions#~lint: functions#
7 verbose lifecycle functions#~lint: unsafe-perm in lifecycle true
8 verbose lifecycle functions#~lint: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/superlelo/Desktop/publishToday/functions/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/usr/games:/sbin:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/superlelo/bin:/usr/bin/java/bin:/home/superlelo/Android/sdk/emulator:/home/superlelo/Android/sdk/tools:/home/superlelo/Android/sdk/tools/bin:/home/superlelo/Android/sdk/platform-tools
9 verbose lifecycle functions#~lint: CWD: /home/superlelo/Desktop/publishToday/functions
10 silly lifecycle functions#~lint: Args: [ '-c', 'eslint .' ]
11 silly lifecycle functions#~lint: Returned: code: 126 signal: null
12 info lifecycle functions#~lint: Failed to exec lint script
13 verbose stack Error: functions# lint: `eslint .`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198: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:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid functions#
15 verbose cwd /home/superlelo/Desktop/publishToday
16 verbose Linux 4.15.0-64-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "--prefix" "/home/superlelo/Desktop/publishToday/functions" "run" "lint"
18 verbose node v10.16.3
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 126
22 error functions# lint: `eslint .`
22 error Exit status 126
23 error Failed at the functions# lint script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
Can anyone suggest how can I resolve this? I am using npm 6.9.0 on a linux Ubuntu bionic beaver.
Thanks
I've installed the eslint package and added a series of scripts to package.json.
"scripts": {
"start": "node index.js",
"test": "node_modules/.bin/jasmine-node spec --color --verbose --autotest --watch .",
"acceptance": "node_modules/.bin/forever stopall && node_modules/.bin/forever start index.js && ./node_modules/.bin/jasmine-node test/ --verbose && node_modules/.bin/forever stopall",
"coverage": "./node_modules/.bin/istanbul cover -x **spec/** -x **index.js** -x **debug.js** jasmine-node spec",
"doc": "node_modules/.bin/jsdoc modules/",
"linter": "node_modules/.bin/eslint ."
}
When running these scripts I meet with mixed success. npm run test, nom run coverage, nom run doc all run without errors but npm run acceptance and npm run linter run the script then throw a series of errors, (I have copied the linter example below).
npm ERR! Darwin 16.0.0
npm ERR! argv "/Users/user/.nvm/versions/node/v6.7.0/bin/node"
"/Users/user/.nvm/versions/node/v6.7.0/bin/npm" "run" "linter"
npm ERR! node v6.7.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! todo#1.0.0 linter: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the todo#1.0.0 linter script 'eslint .'.
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 todo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs todo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls todo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/user/Documents/todo/npm-debug.log
The acceptance tests won't even start the script before running. Why am I getting these errors? The contents of npm-debug.log are:
0 info it worked if it ends with ok
1 verbose cli [ '/Users/user/.nvm/versions/node/v6.7.0/bin/node',
1 verbose cli '/Users/user/.nvm/versions/node/v6.7.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'linter' ]
2 info using npm#3.10.3
3 info using node#v6.7.0
4 verbose run-script [ 'prelinter', 'linter', 'postlinter' ]
5 info lifecycle todo#1.0.0~prelinter: todo#1.0.0
6 silly lifecycle todo#1.0.0~prelinter: no script for prelinter, continuing
7 info lifecycle todo#1.0.0~linter: todo#1.0.0
8 verbose lifecycle todo#1.0.0~linter: unsafe-perm in lifecycle true
9 verbose lifecycle todo#1.0.0~linter: PATH: /Users/user/.nvm/versions/node/v6.7.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/user/Documents/todo/node_modules/.bin:/Users/user/.nvm/versions/node/v6.7.0/bin:/Users/user/google-cloud-sdk/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/user/.nvm/versions/node/v6.7.0/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/usr/texbin
10 verbose lifecycle todo#1.0.0~linter: CWD: /Users/user/Documents/todo
11 silly lifecycle todo#1.0.0~linter: Args: [ '-c', 'eslint .' ]
12 silly lifecycle todo#1.0.0~linter: Returned: code: 1 signal: null
13 info lifecycle todo#1.0.0~linter: Failed to exec linter script
14 verbose stack Error: todo#1.0.0 linter: `eslint .`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/Users/user/.nvm/versions/node/v6.7.0/lib/node_modules/npm/lib/utils/lifecycle.js:242:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/Users/user/.nvm/versions/node/v6.7.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid todo#1.0.0
16 verbose cwd /Users/user/Documents/todo
17 error Darwin 16.0.0
18 error argv "/Users/user/.nvm/versions/node/v6.7.0/bin/node" "/Users/user/.nvm/versions/node/v6.7.0/bin/npm" "run" "linter"
19 error node v6.7.0
20 error npm v3.10.3
21 error code ELIFECYCLE
22 error todo#1.0.0 linter: `eslint .`
22 error Exit status 1
23 error Failed at the todo#1.0.0 linter script 'eslint .'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the todo package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error eslint .
23 error You can get information on how to open an issue for this project with:
23 error npm bugs todo
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls todo
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
I have implemented a testcase for my script and it runs pretty fine when I execute it in Webstorm with the configuration for mocha.
The name of my test script is adminTest.js.
Now I like to have a npm script to run it from the console or later from the build server.
Therefor I have made a script entry in my package.json
Here is the complete file:
{
"name": "cdh",
"version": "0.0.1",
"description": "CDH connector",
"main": "cdh.js",
"private" : true,
"dependencies": {
"cli-color": "^1.0.0",
"handlebars": "^4.0.3",
"sync-request": "^2.0.1",
"jslint": "^0.9.3",
"xmldom": "^0.1.19",
"xpath": "^0.0.9",
"mocha": "2.3.3 ",
"proxyquire": "1.7.3",
"mocha-sinon": "1.1.4",
"jasmine" : "2.3.2",
"chai" : "3.4.1"
},
"devDependencies": {},
"scripts": {
"test": "node ./node_modules/mocha/bin/mocha tests/**/*Test.js --reporter spec"
},
"author": "kme",
"license": "ISC"
}
When I start the script with npm run test from the console it leads to this error:
> cdh#0.0.1 test C:\src\trunk\scripts\testing
> node ./node_modules/mocha/bin/mocha tests/**/*Test.js --reporter spec
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "run" "test"
npm ERR! node v4.2.0
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! cdh#0.0.1 test: `node ./node_modules/mocha/bin/mocha tests/**/*Test.js
--reporter spec`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cdh#0.0.1 test script 'node ./node_modules/mocha/bin/moch
a tests/**/*Test.js --reporter spec'.
npm ERR! This is most likely a problem with the cdh package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./node_modules/mocha/bin/mocha tests/**/*Test.js --reporter sp
ec
npm ERR! You can get their info via:
npm ERR! npm owner ls cdh
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\src\trunk\scripts\testing\npm-debug.log
The npm-debug.log file looks like:
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 'test' ]
2 info using npm#2.14.7
3 info using node#v4.2.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info pretest cdh#0.0.1
6 info test cdh#0.0.1
7 verbose unsafe-perm in lifecycle true
8 info cdh#0.0.1 Failed to exec test script
9 verbose stack Error: cdh#0.0.1 test: `node ./node_modules/mocha/bin/mocha tests/**/*Test.js --reporter spec`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:818:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid cdh#0.0.1
11 verbose cwd C:\src\trunk\scripts\testing
12 error Windows_NT 6.1.7601
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
14 error node v4.2.0
15 error npm v2.14.7
16 error code ELIFECYCLE
17 error cdh#0.0.1 test: `node ./node_modules/mocha/bin/mocha tests/**/*Test.js --reporter spec`
17 error Exit status 1
18 error Failed at the cdh#0.0.1 test script 'node ./node_modules/mocha/bin/mocha tests/**/*Test.js --reporter spec'.
18 error This is most likely a problem with the cdh package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node ./node_modules/mocha/bin/mocha tests/**/*Test.js --reporter spec
18 error You can get their info via:
18 error npm owner ls cdh
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
Your script definition should not include node:
"scripts": {
"test": "./node_modules/mocha/bin/mocha tests/**/*Test.js --reporter spec"
},
Or, if mocha is installed globally:
"scripts": {
"test": "mocha tests/**/*Test.js --reporter spec"
},
See also: Configure node npm package.json so that "npm test" works on both unix and windows.
Update: Ah is see you are working on windows, try changing the script as mentioned in the above post:
"testOnWindowsUseThis" : "node node_modules/mocha/bin/mocha"
Use npx mocha if npm run test doesn't work.