当我使用命令“npm start”时将显示以下错误。
> callcenter@0.1.0 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! callcenter@0.1.0 start: `react-scripts start`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the callcenter@0.1.0 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
Run Code Online (Sandbox Code Playgroud)
小智 9
我遇到了同样的问题,令人惊讶的是它在 Windows 中运行良好,但在 Linux 中失败并给出相同的错误。请按照以下步骤解决此问题。
您需要package.json像下面这样更改项目文件夹中的文件,而不是默认值"start": "react-scripts start"
“脚本”:{“开始”:“
node ./node_modules/react-scripts/bin/react-scripts.js start”}
小智 7
虽然OP并没有真正提到我的问题,但这是搜索时在Google中的第一个stackexchange
yarn build webpack: Permission denied结果,因此我在这里添加我的解决方案,以防它对某人有帮助。
对于那些登陆这里的人来说,因为他们在 Linux 上运行webpack: Permission denied时发现,即使该命令在 Windows 上运行良好:yarn build
我的问题是这些*.lock文件与生成它们的环境(Windows)有一些关系,并且无法在不同的环境(WSL2 - Ubuntu)中工作
消除node_modules
rm -vrf node_modules
Run Code Online (Sandbox Code Playgroud)
移除锁
rm package-lock.json
rm yarn.lock
Run Code Online (Sandbox Code Playgroud)
跑步yarn
yarn
yarn build
Run Code Online (Sandbox Code Playgroud)
确保您的react-script二进制文件是可执行的。
$ chmod +x node_modules/.bin/react-scripts
Run Code Online (Sandbox Code Playgroud)