账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    git-bash执行npm命令提示'"node"' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
    35
    0

    环境变量已经配置过了,我使用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 npm@6.13.4
    3 info using node@v12.14.1
    4 verbose run-script [ 'preupall', 'upall', 'postupall' ]
    5 info lifecycle hexo-site@0.0.0~preupall: hexo-site@0.0.0
    6 info lifecycle hexo-site@0.0.0~upall: hexo-site@0.0.0
    7 verbose lifecycle hexo-site@0.0.0~upall: unsafe-perm in lifecycle true
    8 verbose lifecycle hexo-site@0.0.0~upall: PATH: D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;F:\whiteS18.github.io\node_modules\.bin;D:\Git\mingw64\bin;D:\Git\usr\bin;C:\Users\SCW\bin;F:\whiteS18.github.io\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;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)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;D:\Java\jdk1.8.0_241\bin;D:\Java\jdk1.8.0_241\jre\bin;.;D:\apache-maven-3.6.2\bin";D:\nodejs;D:\Git\mingw64\libexec\git-core;D:\Git\usr\bin;C:\Windows\system3;.;C:\Windows;C:\Windows\System32\Wbem;C:\Users\SCW\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Bandizip;D:\Microsoft VS Code\bin;D:\JetBrains\IntelliJ IDEA 2019.3.1\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Users\SCW\AppData\Local\BypassRuntm;C:\Users\SCW\AppData\Roaming\npm;D:\nodejs
    9 verbose lifecycle hexo-site@0.0.0~upall: CWD: F:\whiteS18.github.io
    10 silly lifecycle hexo-site@0.0.0~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 hexo-site@0.0.0~upall: Returned: code: 9009  signal: null
    12 info lifecycle hexo-site@0.0.0~upall: Failed to exec upall script
    13 verbose stack Error: hexo-site@0.0.0 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:\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
    13 verbose stack     at EventEmitter.emit (events.js:223:5)
    13 verbose stack     at ChildProcess.<anonymous> (D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.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 hexo-site@0.0.0
    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 hexo-site@0.0.0 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 hexo-site@0.0.0 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 npm@6.13.4
    3 info using node@v12.14.1
    4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
    5 info lifecycle cwsong@0.1.0~preserve: cwsong@0.1.0
    6 info lifecycle cwsong@0.1.0~serve: cwsong@0.1.0
    7 verbose lifecycle cwsong@0.1.0~serve: unsafe-perm in lifecycle true
    8 verbose lifecycle cwsong@0.1.0~serve: PATH: D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;F:\cwsong\node_modules\.bin;D:\Git\mingw64\bin;D:\Git\usr\bin;C:\Users\SCW\bin;F:\cwsong\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;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)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;D:\Java\jdk1.8.0_241\bin;D:\Java\jdk1.8.0_241\jre\bin;.;D:\apache-maven-3.6.2\bin";D:\nodejs;D:\Git\mingw64\libexec\git-core;D:\Git\usr\bin;C:\Windows\system3;.;C:\Windows;C:\Windows\System32\Wbem;C:\Users\SCW\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Bandizip;D:\Microsoft VS Code\bin;D:\JetBrains\IntelliJ IDEA 2019.3.1\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Users\SCW\AppData\Local\BypassRuntm;C:\Users\SCW\AppData\Roaming\npm;D:\nodejs
    9 verbose lifecycle cwsong@0.1.0~serve: CWD: F:\cwsong
    10 silly lifecycle cwsong@0.1.0~serve: Args: [ '/d /s /c', 'vue-cli-service serve' ]
    11 silly lifecycle cwsong@0.1.0~serve: Returned: code: 9009  signal: null
    12 info lifecycle cwsong@0.1.0~serve: Failed to exec serve script
    13 verbose stack Error: cwsong@0.1.0 serve: `vue-cli-service serve`
    13 verbose stack Exit status 9009
    13 verbose stack     at EventEmitter.<anonymous> (D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
    13 verbose stack     at EventEmitter.emit (events.js:223:5)
    13 verbose stack     at ChildProcess.<anonymous> (D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.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 cwsong@0.1.0
    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 cwsong@0.1.0 serve: `vue-cli-service serve`
    22 error Exit status 9009
    23 error Failed at the cwsong@0.1.0 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
    $

    请问该怎么解决呢???

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 掏枪毙了你 普通会员 1楼

      这可能是因为你的系统上没有Node.js包,或者Node.js包还没有被npm全局安装。你可以尝试在终端中输入以下命令来安装Node.js包:

      bash sudo npm install -g node

      或者,如果你使用的是Homebrew,可以使用以下命令来安装:

      bash brew install node

      如果你仍然遇到问题,你可能需要检查你的Node.js包是否被npm正确安装,或者你的npm是否有足够的权限来运行这个命令。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部