当我使用命令“npm start”时,将显示以下错误。
> [email protected] start /var/www/html/dev/callcenter
> react-scripts start
sh: 1: react-scripts: Permission denied
npm ERR! Linux 4.4.0-1013-aws
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the callcenter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs callcenter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls callcenter
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/dev/callcenter/npm-debug.log
答案1
确保您的react-script
二进制文件是可执行的。
$ chmod +x node_modules/.bin/react-scripts
答案2
我遇到了同样的问题,令人惊讶的是它在 Windows 中工作正常,但在 Linux 中失败并给出相同的错误。请按照以下步骤解决此问题。
您需要更改package.json
项目文件夹中的文件,如下所示,而不是默认值"start": "react-scripts start"
“脚本”:{“开始”:“
node ./node_modules/react-scripts/bin/react-scripts.js start
”}
答案3
虽然OP并没有真正提到我的问题,但这是第一个堆栈交换搜索时会在 Google 中得到结果
yarn build webpack: Permission denied
,因此我在这里添加我的解决方案,以防它对某人有所帮助。
对于那些登陆这里的人来说,因为他们正在webpack: Permission denied
寻找yarn build
尽管该命令在 Windows 上运行良好,但在 Linux 上运行:
我的问题是这些*.lock
文件与生成它们的环境(Windows)有一些关系,并且无法在不同的环境(WSL2 - Ubuntu)中工作
消除
node_modules
rm -vrf node_modules
移除锁
rm package-lock.json rm yarn.lock
跑步
yarn
yarn yarn build
答案4
删除你的节点模块文件夹并使用 再次安装npm install
。