我的npm脚本无法使用Yarn。
通常我会运行npm start
或npm run build
,脚本会成功执行。当我尝试使用yarn start
/ yarn run start
/ yarn run build
运行这些时,我会收到错误:
yarn start v0.15.1
$ "node server"
sh: node server: command not found
error Command failed with exit code 127.
我通过npm在全球范围内安装了Yarn。在终端中运行zsh。
更新:看起来这是一个v0.15.1错误,不再是0.16中的问题。*
答案 0 :(得分:3)
Update your yarn package with npm or reinstall using brew.
I'm using nvm for npm/node and I had the same problem with v0.15.1. Solved it by upgrading yarn to v0.16.1.
答案 1 :(得分:1)
看起来像纱线中的一个错误,并在以下PR中修复:https://github.com/yarnpkg/yarn/pull/1180
将您的纱线更新为0.16.1并进行测试。希望它能起作用。
答案 2 :(得分:0)
好的,所以我几天来一直被这个问题困扰。我做了我在互联网上看到的一切:重新安装纱线,更新它,尝试不同的命令等......
我想确切地说我在 Ubuntu 上工作。
那么什么对我有用:我在我的根目录中看到了一个 node_modules、package.json 和其他类似的文件,所以我只是删除了它们,然后在我的 react 项目中运行后:“yarn start”并且它起作用了!所以要小心,你的根目录中没有 init 来自你的 react-app 的一些文件,如果是,请删除它们。