当我输入“npm run build:prod”时
build:prod
npm run build -- --configuration production --aot --optimization=false
我遇到了以下错误:
> fancy-name@0.0.0 build:prod
> npm run build -- --configuration production --aot --optimization=false
glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/root/.npm/_logs'
}
npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm WARN logfile error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
npm WARN logfile errno: -13,
npm WARN logfile code: 'EACCES',
npm WARN logfile syscall: 'scandir',
npm WARN logfile path: '/root/.npm/_logs'
npm WARN logfile }
⸨⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⸩ ⠙ : WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
> fancy-name@0.0.0 build
> ng build "--configuration" "production" "--aot" "--optimization=false"
Node.js version v17.4.0 detected.file Error: EACCES: permission denied, scandir '/root/.npm/_logs'
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
This version of CLI is only compatible with Angular versions ^13.0.0-next || >=13.0.0 <14.0.0,ogs'
but Angular version 12.1.3 was found instead.
Please visit the link below to find instructions on how to update Angular.
https://update.angular.io/
我已经尝试删除node_module和package.json,并再次运行NPM install
,但它没有起作用(Linux 4.19.0-16-cloud-amd64)。
编辑:使用chown -R root /path/of/your/project
解决了问题。
chown -R root /path/of/your/project
。 - oligofren