Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
795 views
in Technique[技术] by (71.8m points)

git-bash执行npm命令提示'"node"' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

环境变量已经配置过了,我使用cmd进行操作就可以,使用bash就会提示这个,npm install是可以正常运行的,错误日志提示如下
项目1:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'D:\nodejs\node.exe',
1 verbose cli   'D:\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'upall'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preupall', 'upall', 'postupall' ]
5 info lifecycle [email protected]~preupall: [email protected]
6 info lifecycle [email protected]~upall: [email protected]
7 verbose lifecycle [email protected]~upall: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~upall: PATH: D:
odejs
ode_modules
pm
ode_modules
pm-lifecycle
ode-gyp-bin;F:whiteS18.github.io
ode_modules.bin;D:Gitmingw64in;D:Gitusrin;C:UsersSCWin;F:whiteS18.github.io
ode_modules.bin;C:Program Files (x86)Common FilesOracleJavajavapath;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:WindowsSystem32OpenSSH;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:Program FilesIntelWiFiin;C:Program FilesCommon FilesIntelWirelessCommon;D:Javajdk1.8.0_241in;D:Javajdk1.8.0_241jrein;.;D:apache-maven-3.6.2in";D:
odejs;D:Gitmingw64libexecgit-core;D:Gitusrin;C:Windowssystem3;.;C:Windows;C:WindowsSystem32Wbem;C:UsersSCWAppDataLocalMicrosoftWindowsApps;C:Program FilesBandizip;D:Microsoft VS Codein;D:JetBrainsIntelliJ IDEA 2019.3.1in;C:Program FilesIntelWiFiin;C:Program FilesCommon FilesIntelWirelessCommon;C:UsersSCWAppDataLocalBypassRuntm;C:UsersSCWAppDataRoaming
pm;D:
odejs
9 verbose lifecycle [email protected]~upall: CWD: F:whiteS18.github.io
10 silly lifecycle [email protected]~upall: Args: [
10 silly lifecycle   '/d /s /c',
10 silly lifecycle   'cross-env hexo cl && hexo g && gulp && hexo d && git add . && git commit -m " quick update" && git push origin source '
10 silly lifecycle ]
11 silly lifecycle [email protected]~upall: Returned: code: 9009  signal: null
12 info lifecycle [email protected]~upall: Failed to exec upall script
13 verbose stack Error: [email protected] upall: `cross-env hexo cl && hexo g && gulp && hexo d && git add . && git commit -m " quick update" && git push origin source `
13 verbose stack Exit status 9009
13 verbose stack     at EventEmitter.<anonymous> (D:
odejs
ode_modules
pm
ode_modules
pm-lifecycleindex.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:223:5)
13 verbose stack     at ChildProcess.<anonymous> (D:
odejs
ode_modules
pm
ode_modules
pm-lifecyclelibspawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:223: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 [email protected]
15 verbose cwd F:whiteS18.github.io
16 verbose Windows_NT 10.0.18362
17 verbose argv "D:\nodejs\node.exe" "D:\nodejs\node_modules\npm\bin\npm-cli.js" "run" "upall"
18 verbose node v12.14.1
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 9009
22 error [email protected] upall: `cross-env hexo cl && hexo g && gulp && hexo d && git add . && git commit -m " quick update" && git push origin source `
22 error Exit status 9009
23 error Failed at the [email protected] upall script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 9009, true ]

项目2:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'D:\nodejs\node.exe',
1 verbose cli   'D:\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'serve'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle [email protected]~preserve: [email protected]
6 info lifecycle [email protected]~serve: [email protected]
7 verbose lifecycle [email protected]~serve: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~serve: PATH: D:
odejs
ode_modules
pm
ode_modules
pm-lifecycle
ode-gyp-bin;F:cwsong
ode_modules.bin;D:Gitmingw64in;D:Gitusrin;C:UsersSCWin;F:cwsong
ode_modules.bin;C:Program Files (x86)Common FilesOracleJavajavapath;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:WindowsSystem32OpenSSH;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:Program FilesIntelWiFiin;C:Program FilesCommon FilesIntelWirelessCommon;D:Javajdk1.8.0_241in;D:Javajdk1.8.0_241jrein;.;D:apache-maven-3.6.2in";D:
odejs;D:Gitmingw64libexecgit-core;D:Gitusrin;C:Windowssystem3;.;C:Windows;C:WindowsSystem32Wbem;C:UsersSCWAppDataLocalMicrosoftWindowsApps;C:Program FilesBandizip;D:Microsoft VS Codein;D:JetBrainsIntelliJ IDEA 2019.3.1in;C:Program FilesIntelWiFiin;C:Program FilesCommon FilesIntelWirelessCommon;C:UsersSCWAppDataLocalBypassRuntm;C:UsersSCWAppDataRoaming
pm;D:
odejs
9 verbose lifecycle [email protected]~serve: CWD: F:cwsong
10 silly lifecycle [email protected]~serve: Args: [ '/d /s /c', 'vue-cli-service serve' ]
11 silly lifecycle [email protected]~serve: Returned: code: 9009  signal: null
12 info lifecycle [email protected]~serve: Failed to exec serve script
13 verbose stack Error: [email protected] serve: `vue-cli-service serve`
13 verbose stack Exit status 9009
13 verbose stack     at EventEmitter.<anonymous> (D:
odejs
ode_modules
pm
ode_modules
pm-lifecycleindex.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:223:5)
13 verbose stack     at ChildProcess.<anonymous> (D:
odejs
ode_modules
pm
ode_modules
pm-lifecyclelibspawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:223: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 [email protected]
15 verbose cwd F:cwsong
16 verbose Windows_NT 10.0.18362
17 verbose argv "D:\nodejs\node.exe" "D:\nodejs\node_modules\npm\bin\npm-cli.js" "run" "serve"
18 verbose node v12.14.1
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 9009
22 error [email protected] serve: `vue-cli-service serve`
22 error Exit status 9009
23 error Failed at the [email protected] serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 9009, true ]

这两个命令我通过cmd去执行是可以正常执行的
我的node,npm版本如下

SCW@DESKTOP-73RCKME MINGW64 ~/Desktop
$ node -v
v12.14.1

SCW@DESKTOP-73RCKME MINGW64 ~/Desktop
$ npm -v
6.13.4

SCW@DESKTOP-73RCKME MINGW64 ~/Desktop
$

请问该怎么解决呢???


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

目前又可以用了,我的操作是:

  1. 卸载git和nodejs
  2. 找到nodejs安装的位置,看文件夹是否还在,还在就删除掉
  3. 下载最新git的nodejsLTS版本.在这里下载
  4. 因为我之前的文件夹已经删除了,所以需要设置node全局目录,设置淘宝镜像源重新安装组件(这个根据需要来,百度教程很多)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...