我正在尝试运行npm run dev
,但发生以下错误:
sh: 1: cross-env: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/shanmaseen/.npm/_logs/2019-02-22T16_32_08_191Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/shanmaseen/.npm/_logs/2019-02-22T16_32_08_241Z-debug.log
我已经在互联网上搜索了一个星期,根本没有帮助!
我什至试图从package.json脚本中删除'cross-env',但是随后webpack:权限被拒绝,这表明权限错误不是通过自身自身本身的env-env来实现的。
这是错误日志:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm@6.7.0
3 info using node@v11.10.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle @~predev: @
6 info lifecycle @~dev: @
7 verbose lifecycle @~dev: unsafe-perm in lifecycle true
8 verbose lifecycle @~dev: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/media/e/www/mwar/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle @~dev: CWD: /media/e/www/mwar
10 silly lifecycle @~dev: Args: [ '-c', 'npm run development' ]
11 silly lifecycle @~dev: Returned: code: 126 signal: null
12 info lifecycle @~dev: Failed to exec dev script
13 verbose stack Error: @ dev: `npm run development`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:197:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:197:13)
13 verbose stack at maybeClose (internal/child_process.js:984:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid @
15 verbose cwd /media/e/www/mwar
16 verbose Linux 4.18.0-15-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
18 verbose node v11.10.0
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 126
22 error @ dev: `npm run development`
22 error Exit status 126
23 error Failed at the @ dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
我正在使用laravel 5.7mix。
节点版本:v11.10.0 npm版本:6.7.0
有什么帮助吗?
答案 0 :(得分:9)
这是由于软件包的全局安装存在权限问题,导致npm被拒绝访问。
要解决这个问题
1。
npm rebuild
npm run watch
或2
rm -Rf node_modules
npm install
npm run watch
希望它能起作用。
答案 1 :(得分:4)
答案 2 :(得分:2)
我在Ubuntu 18上。
以下命令对我有帮助:-)
npm rebuild
答案 3 :(得分:0)
好的,我发现了问题所在,保存项目的存储是自动挂载的,并且没有执行权限。
在/ etc / fstab文件中,我很容易在安装选项中添加了exec
,如下所示:
auto,user,exec,utf8,uid=1000,gid=1000,rw 0 0
答案 4 :(得分:0)
尝试一下。
$ rm -rf node_modules
$ npm cache clear --force
$ npm install npm@latest -g
$ chown -R $USER ~/.npm
$ npm install
答案 5 :(得分:0)
我删除了Nodejs并安装了最新版本的Nodejs
答案 6 :(得分:0)
正如@savedbeau 所建议的,运行以下命令可以解决这个问题:
rpm rebuild
关注
rpm run watch