когда я запускаю узел из npm -скриптов, он не будет работать и сообщать мне, что узел не может быть найден, в то время как в других местах, таких как powershell, cmd, это просто нормально. как это случилось?
пакет. json
{
"name": "linux_cmd",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "node"
},
"keywords": [],
"author": "",
"license": "ISC"
}
npm запуск теста --- сбой
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'D:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'test'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.14.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle linux_cmd@1.0.0~pretest: linux_cmd@1.0.0
6 info lifecycle linux_cmd@1.0.0~test: linux_cmd@1.0.0
7 verbose lifecycle linux_cmd@1.0.0~test: unsafe-perm in lifecycle true
8 verbose lifecycle linux_cmd@1.0.0~test: PATH: D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\lenovo\playground\linux_cmd\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\lenovo\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS;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:\Program Files\java\jdk1.8.0_144\bi;C:\Program Files\java\jdk1.8.0_144\jre\bin";C:\Program Files\MySQL\MySQL Utilities 1.6;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;D:\Program Files\TortoiseGit\bin;D:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;D:\Program Files\nodejs;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files (x86)\Python\Scripts;C:\Program Files (x86)\Python;C:\soft\jdk1.8.0_181\bin;C:\Users\lenovo\AppData\Roaming\npm;C:\Users\lenovo\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\lenovo\Downloads\cmder;C:\Users\lenovo\AppData\Local\Microsoft\WindowsApps;D:\Program Files\nodejs
9 verbose lifecycle linux_cmd@1.0.0~test: CWD: C:\Users\lenovo\playground\linux_cmd
10 silly lifecycle linux_cmd@1.0.0~test: Args: [ '/d /s /c', 'node' ]
11 silly lifecycle linux_cmd@1.0.0~test: Returned: code: 1 signal: null
12 info lifecycle linux_cmd@1.0.0~test: Failed to exec test script
13 verbose stack Error: linux_cmd@1.0.0 test: `node`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess.<anonymous> (D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid linux_cmd@1.0.0
15 verbose cwd C:\Users\lenovo\playground\linux_cmd
16 verbose Windows_NT 10.0.18362
17 verbose argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
18 verbose node v12.14.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error linux_cmd@1.0.0 test: `node`
22 error Exit status 1
23 error Failed at the linux_cmd@1.0.0 test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
тест . sh --- работа
#!/bin/bash
node
bash тест. sh
$ bash test.sh
Welcome to Node.js v12.14.0.
при запуске узла из npm -скриптов , он не будет работать и скажет мне, что узел не может быть найден, и в других местах, таких как powershell, cmd, это просто нормально. как это случилось?