[英]npm install error and unable to change ownership of root owned files
I'm having trouble to run npm install
, because /home/lab/.npm
has the root owned files.我在运行npm install
遇到问题,因为/home/lab/.npm
有根拥有的文件。 The problem is I am unable to run sudo chown -R lab:laball "/home/lab/.npm"
inside the container.问题是我无法在容器内运行sudo chown -R lab:laball "/home/lab/.npm"
。 However, after I exited from the container, I already ran sudo chown -R lab:laball "/home/lab/.npm"
, but I am unable to see the directories that I saw inside the container (eg _cacache, _locks).但是,在我退出容器后,我已经运行了sudo chown -R lab:laball "/home/lab/.npm"
,但是我无法看到我在容器内看到的目录(例如 _cacache、_locks)。 Any ideas how to resolve this issue?任何想法如何解决这个问题? Thanks!!谢谢!!
npm install error: npm 安装错误:
I have no name!@cbc1d08db018:/app$ npm install
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /home/lab/.npm/_cacache/tmp/1f88540d
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R lab:laball "/home/lab/.npm"
Inside the container with root owned files in /home/lab/.npm:在 /home/lab/.npm 中根拥有文件的容器内:
I have no name!@cbc1d08db018:~/.npm$ ls -l
total 16
drwxr-xr-x 5 root root 4096 Aug 14 18:54 _cacache
drwxr-xr-x 2 root root 4096 Aug 14 19:38 _locks
drwxr-xr-x 2 root root 4096 Aug 14 19:40 _logs
-rw-r--r-- 1 root root 171 Aug 14 19:38 anonymous-cli-metrics.json
/home/lab/.npm/_logs: /home/lab/.npm/_logs:
I have no name!@f8b41f2ab2e8:~/.npm/_logs$ ls -l
total 32
-rw-r--r-- 1 root root 1669 Aug 14 18:58 2020-08-14T18_58_53_223Z-debug.log
-rw-r--r-- 1 root root 1669 Aug 14 19:03 2020-08-14T19_03_25_793Z-debug.log
-rw-r--r-- 1 root root 1669 Aug 14 19:04 2020-08-14T19_04_54_260Z-debug.log
-rw-r--r-- 1 root root 1669 Aug 14 19:21 2020-08-14T19_21_50_439Z-debug.log
-rw-r--r-- 1 root root 1669 Aug 14 19:28 2020-08-14T19_28_06_425Z-debug.log
-rw-r--r-- 1 root root 1669 Aug 14 19:32 2020-08-14T19_32_32_753Z-debug.log
-rw-r--r-- 1 root root 1669 Aug 14 19:40 2020-08-14T19_40_09_432Z-debug.log
-rw-r--r-- 1 root root 1669 Aug 14 19:40 2020-08-14T19_40_44_646Z-debug.log
I have no name!@f8b41f2ab2e8:~/.npm/_logs$ cat 2020-08-14T19_40_44_646Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using npm@6.14.4
3 info using node@v14.2.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle app@1.0.0~predev: app@1.0.0
6 info lifecycle app@1.0.0~dev: app@1.0.0
7 verbose lifecycle app@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle app@1.0.0~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/app/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle app@1.0.0~dev: CWD: /app
10 silly lifecycle app@1.0.0~dev: Args: [ '-c', 'next' ]
11 info lifecycle app@1.0.0~dev: Failed to exec dev script
12 verbose stack Error: app@1.0.0 dev: `next`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:315:20)
12 verbose stack at maybeClose (internal/child_process.js:1051:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
13 verbose pkgid app@1.0.0
14 verbose cwd /app
15 verbose Linux 4.15.0-112-generic
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
17 verbose node v14.2.0
18 verbose npm v6.14.4
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error app@1.0.0 dev: `next`
23 error spawn ENOENT
24 error Failed at the app@1.0.0 dev script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
FYI, you can have a look at the logs in the current directory.仅供参考,您可以查看当前目录中的日志。 And the other way is to remove the _locks folder, and try again to run 'npm install'.另一种方法是删除 _locks 文件夹,然后再次尝试运行“npm install”。 If it's not working, please share the logs.如果它不起作用,请分享日志。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.