无法运行任何 npx 命令。

huangapple go评论47阅读模式
英文:

Cannot run any npx command

问题

每次我运行任何 npx 命令都会出现以下错误消息:

npx create-expo-app myApp
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Name\Documents\Programming\ReactNative
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

我尝试清除 npm 缓存,但没有帮助。

英文:

Every time I run any npx command it gives me an error with the following message:

npx create-expo-app myApp
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Name\Documents\Programming\ReactNative
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

I tried clearing the npm cache, but that didn't helped.

答案1

得分: 0

From the error, it looks like npm thinks your shell is bash, hence the npm ERR! enoent spawn bash ENOENT error. From the "path" in the error message, I'll assume you're working in a Windows environment, where bash is likely not available.

You can see what your shell is by executing npm config ls -l and looking for the script-shell value.

See answer https://stackoverflow.com/questions/74635083/npm-enoent-syscall-spawn-bash-this-is-related-to-npm-not-being-able-to-find-a/74647007#74647007 for more details.

英文:

From the error, it looks like npm thinks your shell is bash, hence the npm ERR! enoent spawn bash ENOENT error. From the "path" in the error message, I'll assume you're working in a Windows environment, where bash is likely not available.

You can see what your shell is by executing npm config ls -l and looking for the script-shell value.

See answer https://stackoverflow.com/questions/74635083/npm-enoent-syscall-spawn-bash-this-is-related-to-npm-not-being-able-to-find-a/74647007#74647007 for more details.

huangapple
  • 本文由 发表于 2023年4月20日 01:27:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76057298.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定