一个 angular 项目运行 npm install 时出现 "permission denied, open '/src/node_modules/.ngcc_lock_file'"错误,请问如何解决?
> ngcc --properties es2015 browser module main --first-only
Error: EACCES: permission denied, open '/src/node_modules/.ngcc_lock_file'
at Object.openSync (node:fs:585:3)
at Module.writeFileSync (node:fs:2153:35)
at NodeJSFileSystem.writeFile (file:///src/node_modules/@angular/compiler-cli/bundles/chunk-CLV7JFJQ.js:357:9)
at LockFileWithChildProcess.write (file:///src/node_modules/@angular/compiler-cli/bundles/chunk-NALI3EFD.js:1721:13)
at AsyncLocker.create (file:///src/node_modules/@angular/compiler-cli/bundles/chunk-NALI3EFD.js:1673:30)
at AsyncLocker.lock (file:///src/node_modules/@angular/compiler-cli/bundles/chunk-NALI3EFD.js:1662:16)
at SingleProcessExecutorAsync.execute (file:///src/node_modules/@angular/compiler-cli/bundles/chunk-NALI3EFD.js:1603:25)
at mainNgcc (file:///src/node_modules/@angular/compiler-cli/bundles/chunk-NALI3EFD.js:2103:19)
at file:///src/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:31:11
at file:///src/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:41:3
npm ERR! code 1
问题与 docker volume 挂载路径有关,删除第一个挂载后问题就解决了
docker run --rm \
-v=/node_modules/:/src/node_modules \
-v=$(pwd)/src/Cnblogs.Web/ClientApp:/src
用管理员身份运行cmd,再执行npm install试试看
... permission denied, open ...
就是权限问题,按对应的系统给 指令 或 文件 赋予权限就行