npm / npm-lifecycle Goto Github PK
View Code? Open in Web Editor NEWnpm lifecycle script runner
License: Other
npm lifecycle script runner
License: Other
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'test' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle [email protected] pretest: [email protected]
6 info lifecycle [email protected] test: [email protected]
7 verbose lifecycle [email protected] test: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected] test: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/app/backend/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle [email protected] test: CWD: /app/backend
10 silly lifecycle [email protected] test: Args: [ '-c',
10 silly lifecycle 'NODE_ENV=test mocha --require babel-register test/**/*sign-in.test.js' ]
11 silly lifecycle [email protected] test: Returned: code: 2 signal: null
12 info lifecycle [email protected] test: Failed to exec test script
13 verbose stack Error: [email protected] test:NODE_ENV=test mocha --require babel-register test/**/*sign-in.test.js
13 verbose stack Exit status 2
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd /app/backend
16 verbose Linux 4.4.0-98-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "test"
18 verbose node v8.9.0
19 verbose npm v5.5.1
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] test:NODE_ENV=test mocha --require babel-register test/**/*sign-in.test.js
22 error Exit status 2
23 error Failed at the [email protected] test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
Node.js version: 8.9.0
npm version: 5.5.1
Command:
NODE_ENV=test mocha --require babel-register test/**/*sign-in.test.js
What's important to is that I use a module that rewrites how modules are required:
Hi there - I stumbled on this project as I was trying to replicate some of the features in Lerna.js. As I was reading their source code, I found npm-lifecycle
. Is there documentation on how to use the API? I will describe my specific problem below, but I think general API documentation would be super helpful.
My problem: I'm trying to set up a monorepo that will work with my company's build tooling, which uses a private NPM registry. As such, I need to npm pack
but not npm publish
each of the "packages" within the monorepo, then let the tooling handle the actual publishing. I have set up a script to (eventually) automate the npm pack
ing of each package, but nothing I try seems to work. Since Lerna is essentially doing the same thing with lerna publish --skip-npm
I figured I would see what they are doing.
However, the when I use npm-lifecycle
to npm pack
, the process silently fails because my packages don't have .hooks
directories (Should they? Is that an expected directory in an NPM package? How do I create it?).
Some documentation on basic (or advanced) usage would really help me out. Thanks!
This error occurred using npm v5.6.0 in a module that had a postinstall life-cycle step. Consistently I would get this error indicating there are too many process.on('SIGINT', ...) event registrations that aren't being removed. If I remove my postinstall step the error disappeared. If I substituted my postinstall step with an empty script I still received this error.
Digging into:
https://github.com/npm/npm/blob/latest/node_modules/npm-lifecycle/index.js
On line 297 the SIGINT event handler is registered:
process.once('SIGINT', procInterupt)
But on line 318 it removes a listener function for the wrong signal:
process.removeListener('SIGTERM', procInterupt)
Clearly, this is a mistake. It should instead be:
process.removeListener('SIGINT', procInterupt)
I made this change to my local copy of npm and verified that I know longer receive the warning. The SIGINT event function is now properly being removed during the npm lifecycle processing.
Let me know if you have any further questions . . .
Hello,
I am new to botpress, I am trying to follow the steps to run
npm start <
following instructions from https://botpress.io/docs/latest/getting_started/trivia_template/
using:
npm v6.3.0
node v8.11.3
Error: Version doesn´t exist in botfile.js
Log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\claude.chelene\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]start: [email protected]
6 info lifecycle [email protected]
7 verbose lifecycle [email protected]start: unsafe-perm in lifecycle truestart: PATH: C:\Users\claude.chelene\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\claude.chelene\Tutorial\step-1\node_modules.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\CVArchiverAddin;C:\Program Files\Java\jre6\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies;C:\Program Files (x86)\Sennheiser\SoftphoneSDK;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\PuTTY;C:\Program Files\nodejs;C:\Users\claude.chelene\AppData\Roaming\npm
8 verbose lifecycle [email protected]
9 verbose lifecycle [email protected]start: CWD: C:\Users\claude.chelene\Tutorial\step-1start: Args: [ '/d /s /c', 'botpress start' ]
10 silly lifecycle [email protected]
11 silly lifecycle [email protected]start: Returned: code: 1 signal: nullstart: Failed to exec start script
12 info lifecycle [email protected]
13 verbose stack Error: [email protected] start: botpress start
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Users\claude.chelene\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess. (C:\Users\claude.chelene\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\claude.chelene\Tutorial\step-1
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\claude.chelene\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "start"
18 verbose node v8.11.3
19 verbose npm v6.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: botpress start
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
os: windows 7
node: 10.1.0
npm: 6.1.0 ([email protected])
.hooks\postinstall
throw error:
> [email protected] postinstall C:\Users\appveyor\AppData\Local\Temp\1\elint_test_system_1529173406888\node_modules\elint
1087> C:\Users\appveyor\AppData\Local\Temp\1\elint_test_system_1529173406888\node_modules\.hooks\postinstall
1088'C:\Users\appveyor\AppData\Local\Temp\1\elint_test_system_1529173406888\node_modules\.hooks\postinstall' is not recognized as an internal or external command,
1089operable program or batch file.
1090npm WARN [email protected] No description
1091npm WARN [email protected] No repository field.
1092npm ERR! Windows_NT 10.0.14393
1093npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "C:\\projects\\elint\\elint-1.4.0.tgz"
1094npm ERR! node v6.14.2
1095npm ERR! npm v3.10.10
1096npm ERR! code ELIFECYCLE
1097
1098npm ERR! [email protected] postinstall: `C:\Users\appveyor\AppData\Local\Temp\1\elint_test_system_1529173406888\node_modules\.hooks\postinstall`
1099npm ERR! Exit status 1
1100npm ERR!
1101npm ERR! Failed at the [email protected] postinstall script 'C:\Users\appveyor\AppData\Local\Temp\1\elint_test_system_1529173406888\node_modules\.hooks\postinstall'.
1102npm ERR! Make sure you have the latest version of node.js and npm installed.
1103npm ERR! If you do, this is most likely a problem with the elint package,
1104npm ERR! not with npm itself.
1105npm ERR! Tell the author that this fails on your system:
1106npm ERR! C:\Users\appveyor\AppData\Local\Temp\1\elint_test_system_1529173406888\node_modules\.hooks\postinstall
1107npm ERR! You can get information on how to open an issue for this project with:
1108npm ERR! npm bugs elint
1109npm ERR! Or if that isn't available, you can get their info via:
1110npm ERR! npm owner ls elint
1111npm ERR! There is likely additional logging output above.
1112
1113npm ERR! Please include the following file with any support request:
1114npm ERR! C:\Users\appveyor\AppData\Local\Temp\1\elint_test_system_1529173406888\npm-debug.log
1115
file node_modules\.hooks\postinstall
:
#!/usr/bin/env node
'use strict';
process.on('uncaughtException', (err) => {
console.log(err);
process.exit(0);
});
const { installFromScripts } = require('elint');
const packageName = process.env.npm_package_name;
const packageNameRegexp = /^(@.+\/)?elint-preset-.+/;
if (packageName && packageNameRegexp.test(packageName)) {
installFromScripts(packageName);
}
os: Manjaro Linux x86_64
node: 10.1.0
npm: 6.1.0 ([email protected])
I create a "postinstall script" in node_modules/.hooks
, and then run npm install
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/asap
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/encoding
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/fbjs/node_modules/core-js
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/foreach
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/function-bind
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/has
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/is-callable
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/is-date-object
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
(node:32402) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() to increase limit
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/is-regex
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
> [email protected] postinstall /home/keenwon/Test/ci-test/node_modules/is-symbol
> /home/keenwon/Test/ci-test/node_modules/.hooks/postinstall
# ....
The node-gyp
v3.8.0 package is using v2.0.0 of tar
that is vulnerable: https://nvd.nist.gov/vuln/detail/CVE-2018-20834
Solution: Upgrade to node-gyp
v4.0.0
Hi Guys my App is crashing randomly and this is the logs we are getting from the debug. I am not sure what could be . the cause of this. Any hint you can provided?
Windows x86 fails to run Node scripts. This is reproducible.
https://github.com/atom-ide-community/fuzzaldrin-plus-fast/pull/29/checks?check_run_id=1324783415#step:6:209
2020-10-29T05:15:36.4387919Z ThreeLetter#legacy: 16275.666ms
2020-10-29T05:15:43.0984527Z npm verb lifecycle [email protected]~benchmark:large: unsafe-perm in lifecycle true
2020-10-29T05:15:43.1135451Z npm verb lifecycle [email protected]~benchmark:large: PATH: C:\hostedtoolcache\windows\node\12.19.0\x86\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\a\fuzzaldrin-plus-fast\fuzzaldrin-plus-fast\node_modules\.bin;C:\hostedtoolcache\windows\node\12.19.0\x86\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\a\fuzzaldrin-plus-fast\fuzzaldrin-plus-fast\node_modules\.bin;C:\Program Files\PowerShell\7;C:\hostedtoolcache\windows\node\12.19.0\x86;C:\Users\runneradmin\.dotnet\tools;C:\Program Files\Mercurial\;C:\Program Files\MongoDB\Server\4.4\bin;C:\ProgramData\kind;C:\vcpkg;C:\cf-cli;C:\Program Files (x86)\NSIS\;C:\Program Files\Mercurial\;C:\hostedtoolcache\windows\stack\2.5.1\x64;C:\ProgramData\chocolatey\lib\ghc.8.10.2.1\tools\ghc-8.10.2\bin;C:\Program Files\dotnet;C:\mysql-5.7.21-winx64\bin;C:\Program Files\R\R-4.0.3\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\Rust\.cargo\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\sbt\bin;C:\hostedtoolcache\windows\go\1.14.10\x64\bin;C:\hostedtoolcache\windows\Python\3.7.9\x64\Scripts;C:\hostedtoolcache\windows\Python\3.7.9\x64;C:\hostedtoolcache\windows\Ruby\2.5.8\x64\bin;C:\Program Files\Java\jdk8u265-b01\bin;C:\aliyun-cli;C:\npm\prefix;C:\Program Files\Microsoft SDKs\Azure\Azure Dev Spaces CLI;C:\Program Files\Microsoft SDKs\Azure\Azure Dev Spaces CLI\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files\Microsoft MPI\Bin\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\Chocolatey\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Docker;C:\Program Files\PowerShell\7\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.3\bin;C:\Program Files (x86)\sbt\bin;C:\Program Files\OpenSSL\bin;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;c:\tools\php;C:\Program Files\TortoiseSVN\bin;C:\SeleniumWebDrivers\ChromeDriver\;C:\SeleniumWebDrivers\EdgeDriver\;C:\Program Files\CMake\bin;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Amazon\SessionManagerPlugin\bin\;C:\Program Files\Amazon\AWSSAMCLI\bin\;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps
2020-10-29T05:15:43.1147132Z npm verb lifecycle [email protected]~benchmark:large: CWD: D:\a\fuzzaldrin-plus-fast\fuzzaldrin-plus-fast
2020-10-29T05:15:43.1148567Z npm info lifecycle [email protected]~benchmark:large: Failed to exec benchmark:large script
2020-10-29T05:15:43.1149508Z npm verb stack Error: [email protected] benchmark:large: `node benchmark/benchmark-large.js`
2020-10-29T05:15:43.1150168Z npm verb stack Exit status 3221226505
2020-10-29T05:15:43.1151023Z npm verb stack at EventEmitter.<anonymous> (C:\hostedtoolcache\windows\node\12.19.0\x86\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
2020-10-29T05:15:43.1151837Z npm verb stack at EventEmitter.emit (events.js:314:20)
2020-10-29T05:15:43.1153123Z npm verb stack at ChildProcess.<anonymous> (C:\hostedtoolcache\windows\node\12.19.0\x86\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
2020-10-29T05:15:43.1153993Z npm verb stack at ChildProcess.emit (events.js:314:20)
2020-10-29T05:15:43.1154592Z npm verb stack at maybeClose (internal/child_process.js:1021:16)
2020-10-29T05:15:43.1155397Z npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
2020-10-29T05:15:43.1156047Z npm verb pkgid [email protected]
2020-10-29T05:15:43.1156764Z npm verb cwd D:\a\fuzzaldrin-plus-fast\fuzzaldrin-plus-fast
2020-10-29T05:15:43.1157293Z npm verb Windows_NT 10.0.14393
2020-10-29T05:15:43.1158248Z npm verb argv "C:\\hostedtoolcache\\windows\\node\\12.19.0\\x86\\node.exe" "C:\\hostedtoolcache\\windows\\node\\12.19.0\\x86\\node_modules\\npm\\bin\\npm-cli.js" "run" "benchmark:large"
2020-10-29T05:15:43.1158947Z npm verb node v12.19.0
2020-10-29T05:15:43.1159244Z npm verb npm v6.14.8
2020-10-29T05:15:43.1159579Z npm ERR! code ELIFECYCLE
2020-10-29T05:15:43.1160093Z npm ERR! errno 3221226505
2020-10-29T05:15:43.1160945Z npm ERR! [email protected] benchmark:large: `node benchmark/benchmark-large.js`
2020-10-29T05:15:43.1161553Z npm ERR! Exit status 3221226505
2020-10-29T05:15:43.1161828Z npm ERR!
2020-10-29T05:15:43.1162365Z npm ERR! Failed at the [email protected] benchmark:large script.
2020-10-29T05:15:43.1163408Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-10-29T05:15:43.1164187Z npm verb exit [ 3221226505, true ]
2020-10-29T05:15:43.1520687Z npm timing npm Completed in 53830ms
2020-10-29T05:15:43.1521852Z
2020-10-29T05:15:43.1523012Z npm ERR! A complete log of this run can be found in:
2020-10-29T05:15:43.1526384Z npm ERR! C:\npm\cache\_logs\2020-10-29T05_15_43_109Z-debug.log
2020-10-29T05:15:43.1605477Z npm verb lifecycle [email protected]~benchmark: unsafe-perm in lifecycle true
2020-10-29T05:15:43.1619050Z npm verb lifecycle [email protected]~benchmark: PATH: C:\hostedtoolcache\windows\node\12.19.0\x86\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\a\fuzzaldrin-plus-fast\fuzzaldrin-plus-fast\node_modules\.bin;C:\Program Files\PowerShell\7;C:\hostedtoolcache\windows\node\12.19.0\x86;C:\Users\runneradmin\.dotnet\tools;C:\Program Files\Mercurial\;C:\Program Files\MongoDB\Server\4.4\bin;C:\ProgramData\kind;C:\vcpkg;C:\cf-cli;C:\Program Files (x86)\NSIS\;C:\Program Files\Mercurial\;C:\hostedtoolcache\windows\stack\2.5.1\x64;C:\ProgramData\chocolatey\lib\ghc.8.10.2.1\tools\ghc-8.10.2\bin;C:\Program Files\dotnet;C:\mysql-5.7.21-winx64\bin;C:\Program Files\R\R-4.0.3\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\Rust\.cargo\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\sbt\bin;C:\hostedtoolcache\windows\go\1.14.10\x64\bin;C:\hostedtoolcache\windows\Python\3.7.9\x64\Scripts;C:\hostedtoolcache\windows\Python\3.7.9\x64;C:\hostedtoolcache\windows\Ruby\2.5.8\x64\bin;C:\Program Files\Java\jdk8u265-b01\bin;C:\aliyun-cli;C:\npm\prefix;C:\Program Files\Microsoft SDKs\Azure\Azure Dev Spaces CLI;C:\Program Files\Microsoft SDKs\Azure\Azure Dev Spaces CLI\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files\Microsoft MPI\Bin\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\Chocolatey\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Docker;C:\Program Files\PowerShell\7\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.3\bin;C:\Program Files (x86)\sbt\bin;C:\Program Files\OpenSSL\bin;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;c:\tools\php;C:\Program Files\TortoiseSVN\bin;C:\SeleniumWebDrivers\ChromeDriver\;C:\SeleniumWebDrivers\EdgeDriver\;C:\Program Files\CMake\bin;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Amazon\SessionManagerPlugin\bin\;C:\Program Files\Amazon\AWSSAMCLI\bin\;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps
2020-10-29T05:15:43.1628624Z npm verb lifecycle [email protected]~benchmark: CWD: D:\a\fuzzaldrin-plus-fast\fuzzaldrin-plus-fast
2020-10-29T05:15:43.1630398Z npm info lifecycle [email protected]~benchmark: Failed to exec benchmark script
2020-10-29T05:15:43.1645857Z npm verb stack Error: [email protected] benchmark: `npm run benchmark:small && npm run benchmark:regular && npm run benchmark:large`
2020-10-29T05:15:43.1647281Z npm verb stack Exit status 3221226505
2020-10-29T05:15:43.1648262Z npm verb stack at EventEmitter.<anonymous> (C:\hostedtoolcache\windows\node\12.19.0\x86\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
2020-10-29T05:15:43.1649470Z npm verb stack at EventEmitter.emit (events.js:314:20)
2020-10-29T05:15:43.1650677Z npm verb stack at ChildProcess.<anonymous> (C:\hostedtoolcache\windows\node\12.19.0\x86\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
2020-10-29T05:15:43.1651906Z npm verb stack at ChildProcess.emit (events.js:314:20)
2020-10-29T05:15:43.1652741Z npm verb stack at maybeClose (internal/child_process.js:1021:16)
2020-10-29T05:15:43.1654078Z npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
2020-10-29T05:15:43.1654850Z npm verb pkgid [email protected]
2020-10-29T05:15:43.1655809Z npm verb cwd D:\a\fuzzaldrin-plus-fast\fuzzaldrin-plus-fast
2020-10-29T05:15:43.1656362Z npm verb Windows_NT 10.0.14393
2020-10-29T05:15:43.1657980Z npm verb argv "C:\\hostedtoolcache\\windows\\node\\12.19.0\\x86\\node.exe" "C:\\hostedtoolcache\\windows\\node\\12.19.0\\x86\\node_modules\\npm\\bin\\npm-cli.js" "run" "benchmark" "--verbose"
2020-10-29T05:15:43.1658690Z npm verb node v12.19.0
2020-10-29T05:15:43.1659433Z npm verb npm v6.14.8
2020-10-29T05:15:43.1659785Z npm ERR! code ELIFECYCLE
2020-10-29T05:15:43.1660662Z npm ERR! errno 3221226505
2020-10-29T05:15:43.1715110Z npm ERR! [email protected] benchmark: `npm run benchmark:small && npm run benchmark:regular && npm run benchmark:large`
2020-10-29T05:15:43.1715872Z npm ERR! Exit status 3221226505
2020-10-29T05:15:43.1716762Z npm ERR!
2020-10-29T05:15:43.1717335Z npm ERR! Failed at the [email protected] benchmark script.
2020-10-29T05:15:43.1718518Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-10-29T05:15:43.1719085Z npm verb exit [ 3221226505, true ]
2020-10-29T05:15:43.1994067Z npm timing npm Completed in 59749ms
2020-10-29T05:15:43.1995140Z
2020-10-29T05:15:43.1996679Z npm ERR! A complete log of this run can be found in:
2020-10-29T05:15:43.1998166Z npm ERR! C:\npm\cache\_logs\2020-10-29T05_15_43_171Z-debug.log
2020-10-29T05:15:43.3769147Z ##[error]Process completed with exit code 1.
2020-10-29T05:15:43.4002032Z Post job cleanup.
2020-10-29T05:15:45.4071469Z [command]"C:\Program Files\Git\bin\git.exe" version
2020-10-29T05:15:45.4259739Z git version 2.29.0.windows.1
2020-10-29T05:15:46.0988598Z [command]"C:\Program Files\Git\bin\git.exe" config --local --name-only --get-regexp core\.sshCommand
2020-10-29T05:15:46.0994281Z [command]"C:\Program Files\Git\bin\git.exe" submodule foreach --recursive "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2020-10-29T05:15:46.0998203Z [command]"C:\Program Files\Git\bin\git.exe" config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2020-10-29T05:15:46.0999033Z http.https://github.com/.extraheader
2020-10-29T05:15:46.1000852Z [command]"C:\Program Files\Git\bin\git.exe" config --local --unset-all http.https://github.com/.extraheader
2020-10-29T05:15:46.1003279Z [command]"C:\Program Files\Git\bin\git.exe" submodule foreach --recursive "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Always
First reproduction:
Repo: https://github.com/atom-ide-community/fuzzaldrin-plus-fast/tree/github-action
This is also similar to the error that happens in the Parcel source map code.
Repo: parcel-bundler/source-map#36
winx86 fails to run Node scripts
I have given the exact repo to reproduce the error above.
On Windows x86:
npm install
npm run benchmark --verbose
Run successfully like other versions
@aminya
cc: @DeMoorJasper
Blocks: atom-community/zadeh#29
Blocks: parcel-bundler/source-map#36
npm-lifeycycle
is using a version of node-gyp
which is pointing to a version of tar
that has a vulnerability. See https://www.npmjs.com/advisories/803.
Hey,
I am trying to handle signals in my application and they may come multiple times.
I found here that the signal is propagated only the first time (the second signal will kill npm process and won't pass it to the child). In some use cases, we want to actually receive the second signal as well.
I also found this post talking to something very similar. In the end, they replaced the npm run start
command of with node index.js
. Is this what npm suggest as best practice in that case?
OS: Windows 10
Node: Any
npm: 6.1.0
As mentioned in npm/npm#20815
Hi all!
The current version of node-gyp used by npm-lifecycle is 4.0.0 which is not compatible with Visual Studio 2019. We had to change our production build machine until this package will be updated :( node-gyp is compatible with Visual Studio 2019 from its 5.0.0 version: nodejs/node-gyp#1747
Thank you!
There are certain scenarios that may give rise to difficult to diagnose issues stemming from path inconsistency issues introduced further upstream in the npm pipeline before landing in lifecycle.
While it's not lifecycle's responsibility to sanitize env pairs, it would be nice if lifecycle preferred OS specific path casing when it's present, vs iterating through all case insensitive matches before using on the last match.
Consider the following being set upstream from lifecycle:
process.env['Path'] = 'c:\\path\\one';
process.env['PATH'] = 'c:\\path\\two';
When instantiated, lifecycle currently evaluates process.env keys with a case insensitive regex match within a forEach - selecting the last match as the path casing that will be used for the remainder of lifecycle processes (including modifying the path with module specific paths). In this scenario, 'PATH' will be used within lifecycle - though ultimately process.env will be passed containing both 'PATH' and 'Path' - at which time win32 platforms will use 'Path' when instantiating the native a Process() instance. Of course, since lifecycle opted for 'PATH' due to it being the last case insensitive match, path modifications that may be required won't be picked up by Process(), which may lead to failure.
I have personally dealt with such a failure, which ultimately resulted in a difficult to diagnose issue with the increasingly popular opencollective and lightcollective libraries being called in postinstall by 3rd party dependencies. While this issue may be mitigated by authors simply adding "|| exit 0" to their postinstall calls to external libraries, not all authors are easily convinced to make this change. There are many reported issues surrounding opencollective and lightercollective erroring with "is not recognized as an internal or external command", specifically on Windows - I figure that it's likely that this is frequently an underlying cause.
I propose that lifecycle use the OS-specific path casing when present on process.env - only falling back to iterating through the keys in search of an alternate when the OS-specific casing isn't present. Pull request imminent.
It is common for a Dockerfile to install an app in a /app
directory. If the app is a node app and it has a "postinstall"
script (and possibly other lifecycle hooks) it will fail with an error that looks like:
npm WARN lifecycle [email protected]~postinstall: cannot run in wd [email protected] npm run exit 0 (wd=/app)
Most of the issues found using a search engine will indicate that this is a permissions issue caused by running as root and npm downgrading permissions to nobody. However, this issue will still occur if the "postinstall" script is "exit 0", which should require no permissions. On the other hand, the suggested workaround of setting --unsafe-perm
works. The relevant lines of code are:
if ((wd.indexOf(opts.dir) !== 0 || _incorrectWorkingDirectory(wd, pkg)) &&
!opts.unsafePerm && pkg.scripts[stage]) {
opts.log.warn('lifecycle', logid(pkg, stage), 'cannot run in wd', pkg._id, pkg.scripts[stage], `(wd=${wd})`)
return resolve()
}
(from index.js, lines 86-90)
Note that employing --unsafe-perm
specifically serves as an escape hatch, though it does not appear to have much to do with permissions on the directory. _incorrectWorkingDirectory()
checks to see if the working directory matches the name of the package in package.json
.
I do not know if this is a bug or intended behavior - it makes sense as a swift heuristic to ensure you are in the expected package - but it is not well documented and conflicts subtly with nodejs.org's recommendations for a Dockerfile.
Hi
An issue found when working on my nprr package and npm-run-all makes me open this issue.
It seems that the env.npm_execpath
is set to require.main.filename
"instead" of $execPath
(used instead to set env.npm_node_execpath
). I don't know if it's right or not and I'm not aware of all the possible side-effects of changing it.
The original problem comes from my nprr package that runs a package.json script through npm.run()
(by importing npm itself). Here's the code that does that.
The "guilty" LOC of this project:
Line 96 in e2270ff
I think that the correct label for this issue should be "support".
Thank you for all
Stefano
Currently npm-lifecycle
relies on the node-gyp-bin folder of npm (https://github.com/npm/lifecycle/blob/latest/index.js#L94). This makes npm-lifecycle not too usable outside of npm itself.
I think node-gyp-bin
should be moved to npm-lifecycle
and node-gyp
should be in dependencies of npm-lifecycle
.
Hi there,
Run-script doesn't seem to be setting environment variables when using WSL, but works fine for Mingw64.
Maybe it has to do with process.platform
being set to 'linux'
in contrast to Mingw64 setting it to 'win32'
.
Node: 8.11.1
NPM: 5.8.0
OS: Windows 10 64bit
Steps to reproduce:
npm config set script-shell C:\\Windows\\System32\\bash.exe
"scripts": { "printenv": "printenv" }
npm run printenv
Result:
TERM=xterm-256color
SHELL=/bin/bash
NAME=compy
USER=ricky
HOSTTYPE=x86_64
PATH=...
_=/usr/bin/printenv
PWD=/mnt/c/Users/ricky
LANG=en_US.UTF-8
HOME=/home/ricky
SHLVL=2
LOGNAME=ricky
Expected:
npm_config_x
and npm_package_x
variables to also be set, so I can use them inside of run-script commands.
npm reports
ENOENT
onnpm install
postinstall errors when running as root
We all know that you shouldn't run npm is root on your local system.
What we don't all know is that apparently new versions of npm change the
uid
to 1001 and if you're running in a virtualized single-user environment, this causespostinstall
scripts to break due to permission errors.
Apparently there's some uid
fudging and whatnot inside of npm.
curl -sS https://webinstall.dev/node@v12 | bash
npm install --save @root/acme
> @root/[email protected] postinstall /root/srv/try-greenlock/node_modules/@root/acme
> node scripts/postinstall
sh: 1: node: Permission denied
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @root/[email protected] postinstall: `node scripts/postinstall`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @root/[email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-24T23_10_59_381Z-debug.log
Either
root
and that not being allowed.ENOENT
uid
s in the first placehttps://github.com/npm/npm-lifecycle/blob/latest/lib/spawn.js#L45
If you console.log(options)
when running as root
you can clearly see that the uid
is set to 1001
.
You can also clearly see that ENOENT
is hard-coded as a best-effort guess as to what the error is, masking the actual error which I believe is due to selecting a non-existing user.
Clone https://github.com/laggingreflex/npm-lifecycle-windows-path-issue on Windows 10 with Node v10/npm6
Run npm test
Should output "If this shows, it worked!"
Results in error "'test' is not recognized as an internal or external command,"
use extract-text-webpack-plugin
0 info it worked if it ends with ok
1 verbose cli [ 'E:\\0java\\nodejs\\node.exe',
1 verbose cli 'E:\\0java\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: E:\0java\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;F:\2.src\enjiu\t2\webpack-demo\node_modules\.bin;C:\ProgramData\Boxstarter;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\GtkSharp\2.12\bin;D:\scala\bin;D:\TortoiseSVN\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\sbt\bin;D:\Go\bin;C:\WINDOWS\System32\OpenSSH\;D:\TortoiseGit\bin;d:\Git\cmd;d:\Microsoft VS Code\bin;C:\ProgramData\chocolatey\bin;E:\0java\nodejs\;D:\Python\Python37\Scripts\;D:\Python\Python37\;C:\Users\Ming\AppData\Local\Programs\Python\Launcher\;C:\Program Files\Intel\WiFi\bin\;D:\Java\jdk1.8.0_152\bin;E:\0java\apache-maven-3.3.9\bin;E:\0java\spring-2.0.0.BUILD-SNAPSHOT\bin;C:\Program Files\Common Files\Intel\WirelessCommon\;F:\9.resource\sbt\activator-dist-1.3.12\bin;E:\0java\play-1.4.4;d:\Fiddler;d:\Microsoft VS Code\bin;C:\Users\Ming\AppData\Local\Microsoft\WindowsApps;E:\Wind\Wind.NET.Client\WindNET\bin\;D:\Wind\WWT\bin\;C:\Users\Ming\AppData\Roaming\npm;F:\9.resource\npm;
9 verbose lifecycle [email protected]~build: CWD: F:\2.src\enjiu\t2\webpack-demo
10 silly lifecycle [email protected]~build: Args: [ '/d /s /c', 'webpack --config=config/webpack.dev.js' ]
11 silly lifecycle [email protected]~build: Returned: code: 1 signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `webpack --config=config/webpack.dev.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (E:\0java\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> (E:\0java\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 [email protected]
15 verbose cwd F:\2.src\enjiu\t2\webpack-demo
16 verbose Windows_NT 10.0.17134
17 verbose argv "E:\\0java\\nodejs\\node.exe" "E:\\0java\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v10.13.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `webpack --config=config/webpack.dev.js`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.