gpt4 book ai didi

node.js - 运行 npm dist 时权限被拒绝

转载 作者:搜寻专家 更新时间:2023-10-31 23:41:06 25 4
gpt4 key购买 nike

我正在尝试部署我的静态站点,为此我正在尝试运行

npm run dist

哪个运行

copyfiles -f ./src/index.html ./src/favicon.ico ./dist

好像是

/Users/Alfred/React/newReactWebpack/reactWebpack/node_modules/.bin/webpack

被锁定不能读/写。我曾尝试使用 chmod 775,也曾尝试通过 sudo 运行它。没有任何帮助。有谁知道可能出了什么问题?

谢谢!


运行命令后控制台输出:

templateApp@0.0.1 dist /Users/Alfred/React/newReactWebpack/reactWebpack
npm run copy & webpack --env=dist
sh: /Users/Alfred/React/newReactWebpack/reactWebpack/node_modules/.bin/webpack: Permission denied

npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/6.2.2/bin/node" "/usr/local/bin/npm" "run" "dist"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! templateApp@0.0.1 dist: npm run copy & webpack --env=dist
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the templateApp@0.0.1 dist script 'npm run copy & webpack --env=dist'.
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 templateApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run copy & webpack --env=dist
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs templateApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls templateApp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/Alfred/React/newReactWebpack/reactWebpack/npm-debug.log

templateApp@0.0.1 copy /Users/Alfred/React/newReactWebpack/reactWebpack
copyfiles -f ./src/index.html ./src/favicon.ico ./dist
sh: /Users/Alfred/React/newReactWebpack/reactWebpack/node_modules/.bin/copyfiles: Permission denied

npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/6.2.2/bin/node" "/usr/local/bin/npm" "run" "copy"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! templateApp@0.0.1 copy: copyfiles -f ./src/index.html ./src/favicon.ico ./dist
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the templateApp@0.0.1 copy script 'copyfiles -f ./src/index.html ./src/favicon.ico ./dist'.
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 templateApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! copyfiles -f ./src/index.html ./src/favicon.ico ./dist
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs templateApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls templateApp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/Alfred/React/newReactWebpack/reactWebpack/npm-debug.log

最佳答案

如果你

chmod 775/Users/Alfred/React/newReactWebpack/reactWebpack/node_modules/.bin/webpack

它只会改变/webpack的权限。

尝试 chmod 775 -R/Users/Alfred/React 这将递归更改 /React 下所有文件夹和文件的权限

如果这不起作用,请尝试将 chown 更改为您的用户名。

chmod 775 on a folder but not all files under that folder

关于node.js - 运行 npm dist 时权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40535692/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com