npm 错误!无法确定要运行的可执行文件

bin*_*ing 9 node.js npm

我想运行我的项目npm run watch,当我什么都不做时,突然出现这样的错误。

git:(master) ? npm run watch

> watch
> npx mix watch

npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bintangtobing/.npm/_logs/2021-06-04T08_11_16_499Z-debug.log
Run Code Online (Sandbox Code Playgroud)

有谁知道这些错误?

我已经做了一个解决方案,它是

删除项目文件夹上的 node_modules 并运行npm install,但仍然出现相同的错误。

任何人都可以帮助我吗?谢谢大家。

Sr.*_*DRO 108

最终做了

rm -rf .git/hooks
npm install
Run Code Online (Sandbox Code Playgroud)

遵循此建议https://github.com/npm/cli/issues/1845#issuecomment-814884999

为我工作

  • `rm -rf .git/hooks` 很有魅力! (2认同)

Eri*_*rez 36

它对我有用:

npm uninstall husky && npm install --save-dev husky@4
Run Code Online (Sandbox Code Playgroud)

发生这种情况是因为 git 正在尝试查找不存在的文件(版本 5 中),因此降级会有所帮助,我知道这不是最好的解决方案,但可以帮助某人。

或者尝试迁移哈士奇(4到7):

https://github.com/typicode/husky-4-to-7

  • 之所以有效,是因为 4 之后的 husky 版本停止自动安装 git hooks。他们在这里提供了如何添加这些内容的说明 https://github.com/typicode/husky (3认同)

shm*_*els 12

我的问题是我错误地调用npx start了npm start.

我是从CMD我的Dockerfile.

我意识到这不是操作问题,但错误和标题可能会将其他遇到此错误的人带到这里。

  • 这正是我的问题所在。感谢您发布此内容。 (2认同)

Roo*_*N3y 10

npm install

我在尝试调试构建问题后遇到了这个问题。我删除了 node_modules并在 Docker 容器中运行该应用程序。但这意味着 husky npm 包在本地不再可用,所以简单地npm install解决了问题


小智 8

就我而言,我使用了错误的 cmd 。 npx 创建react-app 分配

cmd 应该像 npx create-react-app my-project

错误:我在cmd中的create和react之间缺少“-”


Ale*_*lex 7

我必须将节点从 v17.0.1 降级到 v14.18.1,因为我的项目依赖项之一不支持较新的节点版本。

(例如通过“nvm use 14”,请参阅节点版本管理器)


Ani*_*ilS 6

它对我有用:

git commit -m "updating the dependency packages" --no-verify
Run Code Online (Sandbox Code Playgroud)

有时是由于预提交挂钩所致