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.
Related
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'm trying to run react-native start (as all the other days, it works normally) and it gives me this error:
THE ERROR
Loading dependency graph...events.js:287
throw er; // Unhandled 'error' event
^
Error: UNKNOWN: unknown error, lstat 'C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2\node_modules\jest-util\node_modules\.bin\mkdirp'
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError (C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2\node_modules\sane\src\node_watcher.js:143:12)
at Walker.emit (events.js:310:20)
at C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2\node_modules\walker\lib\walker.js:52:12
at FSReqCallback.oncomplete (fs.js:167:21) {
errno: -4094,
code: 'UNKNOWN',
syscall: 'lstat',
path: 'C:\\Users\\OKR\\Desktop\\MeetUp App\\Development\\MeetUp2\\node_modules\\jest-util\\node_modules\\.bin\\mkdirp'
}
ERROR 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 'start'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.16.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle MeetUp2#0.0.1~prestart: MeetUp2#0.0.1
6 info lifecycle MeetUp2#0.0.1~start: MeetUp2#0.0.1
7 verbose lifecycle MeetUp2#0.0.1~start: unsafe-perm in lifecycle true
8 verbose lifecycle MeetUp2#0.0.1~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2\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\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools;C:\Program Files\Java\jdk1.8.0_152\bin;C:\Program Files\nodejs\;C:\Users\OKR\AppData\Local\Microsoft\WindowsApps;C:\Users\OKR\AppData\Local\atom\bin;C:\Users\OKR\AppData\Local\Programs\Microsoft VS Code\bin;c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools;C:\MinGW\bin;D:\Genymotion\tools;C:\Users\OKR\AppData\Roaming\npm
9 verbose lifecycle MeetUp2#0.0.1~start: CWD: C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2
10 silly lifecycle MeetUp2#0.0.1~start: Args: [ '/d /s /c', 'react-native start' ]
11 silly lifecycle MeetUp2#0.0.1~start: Returned: code: 1 signal: null
12 info lifecycle MeetUp2#0.0.1~start: Failed to exec start script
13 verbose stack Error: MeetUp2#0.0.1 start: `react-native start`
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 MeetUp2#0.0.1
15 verbose cwd C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
18 verbose node v12.16.3
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error MeetUp2#0.0.1 start: `react-native start`
22 error Exit status 1
23 error Failed at the MeetUp2#0.0.1 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
WHAT I'VE TRIED
Deleted node_modules packages and package-lock.json and run npm install. It still fails after many trials
Update node.js to the latest-recommended version: 12.16.3. Then repeat the above step and it still fails
Run npm cache clean ( gives error) and reapeat step 1 --> Fail
EDIT 1 I have tried react-native start --reset-cache and it gives the same error
EDIT 2 I've tried: npm cache clean --force and it gives me error:
npm ERR! code UNKNOWN
npm ERR! syscall unlink
npm ERR! path C:\Users\OKR\AppData\Roaming\npm-cache\_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935
npm ERR! errno -4094
npm ERR! UNKNOWN: unknown error, unlink 'C:\Users\OKR\AppData\Roaming\npm-cache\_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\OKR\AppData\Roaming\npm-cache\_logs\2020-05-26T13_16_06_204Z-debug.log
The 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 'cache',
1 verbose cli 'clean',
1 verbose cli '--force'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.16.3
4 warn using --force I sure hope you know what you are doing.
5 verbose npm-session ec09bc51399022bd
6 verbose stack Error: UNKNOWN: unknown error, unlink 'C:\Users\OKR\AppData\Roaming\npm-cache_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935'
7 verbose cwd C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2
8 verbose Windows_NT 10.0.17763
9 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "cache" "clean" "--force"
10 verbose node v12.16.3
11 verbose npm v6.14.4
12 error code UNKNOWN
13 error syscall unlink
14 error path C:\Users\OKR\AppData\Roaming\npm-cache_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935
15 error errno -4094
16 error UNKNOWN: unknown error, unlink 'C:\Users\OKR\AppData\Roaming\npm-cache_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935'
17 verbose exit [ -4094, true ]
(I can't put the above log in code format since Stack Overflow doesn't allow to)
EDIT 3: I've tried to run cmd in administrator mode but it throws the same error
EDIT 4: I've tried npm start and it gives me this error:
Loading dependency graph...events.js:287
throw er; // Unhandled 'error' event
^
Error: UNKNOWN: unknown error, lstat 'C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\jest-util\node_modules\.bin\mkdirp'
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\sane\src\node_watcher.js:143:12)
at Walker.emit (events.js:310:20)
at C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\walker\lib\walker.js:52:12
at FSReqCallback.oncomplete (fs.js:167:21) {
errno: -4094,
code: 'UNKNOWN',
syscall: 'lstat',
path: 'C:\\Users\\OKR\\Desktop\\MeetUp_App\\Development\\MeetUp2\\node_modules\\jest-util\\node_modules\\.bin\\mkdirp'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! MeetUp2#0.0.1 start: `react-native start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the MeetUp2#0.0.1 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\OKR\AppData\Roaming\npm-cache\_logs\2020-05-27T11_29_28_113Z-debug.log
The 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 'start'
1 verbose cli ]
2 info using npm#6.14.5
3 info using node#v12.16.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle MeetUp2#0.0.1~prestart: MeetUp2#0.0.1
6 info lifecycle MeetUp2#0.0.1~start: MeetUp2#0.0.1
7 verbose lifecycle MeetUp2#0.0.1~start: unsafe-perm in lifecycle true
8 verbose lifecycle MeetUp2#0.0.1~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\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\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools;C:\Program Files\Java\jdk1.8.0_152\bin;C:\Program Files\nodejs\;C:\Users\OKR\AppData\Local\Microsoft\WindowsApps;C:\Users\OKR\AppData\Local\atom\bin;C:\Users\OKR\AppData\Local\Programs\Microsoft VS Code\bin;c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools;C:\MinGW\bin;D:\Genymotion\tools;C:\Users\OKR\AppData\Roaming\npm
9 verbose lifecycle MeetUp2#0.0.1~start: CWD: C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2
10 silly lifecycle MeetUp2#0.0.1~start: Args: [ '/d /s /c', 'react-native start' ]
11 silly lifecycle MeetUp2#0.0.1~start: Returned: code: 1 signal: null
12 info lifecycle MeetUp2#0.0.1~start: Failed to exec start script
13 verbose stack Error: MeetUp2#0.0.1 start: `react-native start`
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 MeetUp2#0.0.1
15 verbose cwd C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.16.3
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error MeetUp2#0.0.1 start: `react-native start`
22 error Exit status 1
23 error Failed at the MeetUp2#0.0.1 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
EDIT 5: I've tried to run the command to upgrade react-native using npx react-native upgrade. And it gives this error:
info No version passed. Fetching latest...
info Fetching diff between v0.61.5 and v0.62.2...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:
error Automatically applying diff failed. We did our best to automatically upgrade as many files as possible
warn Continuing after failure. Some of the files are upgraded but you will need to deal with conflicts manually
info Installing "react-native#0.62.2" and its peer dependencies...
error Command failed: npm install --save --save-exact react-native#0.62.2 react#16.11.0
npm ERR! Cannot read property 'match' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\OKR\AppData\Roaming\npm-cache\_logs\2020-05-27T11_26_44_748Z-debug.log
. Run CLI with --verbose flag for more details.
Error: Command failed: npm install --save --save-exact react-native#0.62.2 react#16.11.0
npm ERR! Cannot read property 'match' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\OKR\AppData\Roaming\npm-cache\_logs\2020-05-27T11_26_44_748Z-debug.log
at makeError (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\execa\index.js:174:9)
at C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async installDeps (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\react-native\node_modules\#react-native-community\cli\build\commands\upgrade\upgrade.js:206:3)
at async Object.upgrade [as func] (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\react-native\node_modules\#react-native-community\cli\build\commands\upgrade\upgrade.js:345:9)
at async Command.handleAction (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:182:9)
My package.json
{
"name": "MeetUp2",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#eva-design/eva": "^1.4.0",
"#mapbox/polyline": "^1.1.0",
"#react-native-community/cameraroll": "^1.6.1",
"#react-native-community/datetimepicker": "^2.3.2",
"#react-native-community/google-signin": "^4.0.1",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-firebase/admob": "^6.7.1",
"#react-native-firebase/app": "^6.7.1",
"#react-native-firebase/auth": "^6.7.1",
"#react-native-firebase/firestore": "^6.7.1",
"#react-native-firebase/storage": "^6.7.1",
"#react-navigation/drawer": "^5.7.1",
"#react-navigation/native": "^5.2.6",
"#react-navigation/stack": "^5.3.1",
"#ui-kitten/components": "^4.4.1",
"axios": "^0.19.2",
"lodash": "^4.17.15",
"moment": "^2.25.3",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-collapsingtoolbar": "^1.0.3",
"react-native-device-info": "^5.5.7",
"react-native-fbsdk": "^1.1.2",
"react-native-geolocation-service": "^4.0.1",
"react-native-gesture-handler": "^1.6.1",
"react-native-get-random-values": "^1.4.0",
"react-native-image-picker": "^2.3.1",
"react-native-keychain": "^6.0.0",
"react-native-maps": "^0.27.1",
"react-native-modal-datetime-picker": "^8.6.0",
"react-native-paper": "^3.10.1",
"react-native-reanimated": "^1.8.0",
"react-native-redash": "^14.0.4",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.7.0",
"react-native-share": "^3.3.2",
"react-native-svg": "^12.1.0",
"react-native-tab-view": "^2.14.0",
"react-native-vector-icons": "^6.6.0",
"react-native-view-shot": "^3.1.2",
"react-navigation-header-buttons": "^3.0.5",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"rn-fetch-blob": "^0.12.0",
"uuid": "^8.0.0"
},
"devDependencies": {
"#babel/core": "^7.9.6",
"#babel/runtime": "^7.9.6",
"#react-native-community/eslint-config": "^0.0.7",
"babel-jest": "^25.5.1",
"eslint": "^6.8.0",
"jest": "^25.5.4",
"jetifier": "^1.6.5",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
PLEASE HELP ME
Looks like the issue is with the npm cache. Try the following solution:
Run the command: npm cache verify
If you get errors then run: npm cache clear --force
Right Click on C: > Properties > Tools Tab.
Select Check or Check-now under Error Checking menu.
Reboot your PC after the process is completed.
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'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"
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 ]