"在任何地方都不起作用?-6ren"> "在任何地方都不起作用?-npm run 不适用于任何项目。因此,我无法安装有后安装脚本的软件包 0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cl-6ren">
gpt4 book ai didi

node.js - 为什么 "npm run "在任何地方都不起作用?

转载 作者:太空宇宙 更新时间:2023-11-04 01:20:25 29 4
gpt4 key购买 nike

npm run 不适用于任何项目。因此,我无法安装有后安装脚本的软件包

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'test'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v13.5.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle myapp@0.0.0~pretest: myapp@0.0.0
6 info lifecycle myapp@0.0.0~test: myapp@0.0.0
7 verbose lifecycle myapp@0.0.0~test: unsafe-perm in lifecycle true
8 verbose lifecycle myapp@0.0.0~test: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Vombat\Desktop\Learn\express_template_app\myapp\node_modules\.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:\Windows\System32\OpenSSH\;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\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Users\Vombat\AppData\Local\Microsoft\WindowsApps;C:\Users\Vombat\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Vombat\AppData\Roaming\npm
9 verbose lifecycle myapp@0.0.0~test: CWD: C:\Users\Vombat\Desktop\Learn\express_template_app\myapp
10 silly lifecycle myapp@0.0.0~test: Args: [ '-c', 'node -v' ]
11 info lifecycle myapp@0.0.0~test: Failed to exec test script
12 silly lifecycle myapp@0.0.0~test: Returned: code: -4058 signal: null
13 info lifecycle myapp@0.0.0~test: Failed to exec test script
14 verbose stack Error: myapp@0.0.0 test: `node -v`
14 verbose stack spawn = ENOENT
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
14 verbose stack at onErrorNT (internal/child_process.js:469:16)
14 verbose stack at processTicksAndRejections (internal/process/task_queues.js:84:21)
15 verbose pkgid myapp@0.0.0
16 verbose cwd C:\Users\Vombat\Desktop\Learn\express_template_app\myapp
17 verbose Windows_NT 10.0.18362
18 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
19 verbose node v13.5.0
20 verbose npm v6.13.4
21 error code ELIFECYCLE
22 error syscall spawn =
23 error file =
24 error path =
25 error errno -4058
26 error myapp@0.0.0 test: `node -v`
26 error spawn = ENOENT
27 error Failed at the myapp@0.0.0 test script.
27 error This is probably not a problem with npm. There is likely additional logging output above.
28 verbose exit [ -4058, true ]

我将 Node 更新到最新版本,我尝试了npmcacheclear--forcenpmcacheverify,但没有帮助。操作系统 Windows 10。 Node 版本 13.5.0,npm 版本 6.13.4

最佳答案

确保您已正确设置 NODE_PATH 环境变量。该路径必须与您的nodeJS目录匹配 + \node_modules

enter image description here

关于node.js - 为什么 "npm run <command>"在任何地方都不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59479497/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com