[Pkg-javascript-devel] Bug#960289: npm: 'Permission denied' error when running as root
Nikolay Shaplov
dhyan at nataraj.su
Mon May 11 16:12:28 BST 2020
Package: npm
Version: 5.8.0+ds6-4+deb10u1
Severity: normal
I am still trying to run npm. When I manually set up git, I came to the
next problem:
I run as a root
# cd /srv
# npm install matrix-appservice-irc --global
and get
npm WARN npm npm does not support Node.js v10.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN deprecated request at 2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/matrix-org/node-irc.git /root/.npm/_cacache/tmp/git-clone-7b141b18
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-7b141b18': Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-05-11T14_36_48_511Z-debug.log
The cause of this problem is that, I guess it because it changes uid to
1000 at some place, and run as a user (NB there is no any user with 1000
uid on the container I am working in), and chown .npm folder lo the 1000
user.
You can see
# ls -la /root/ | grep npm
drwxr-xr-x 4 1000 1000 4096 May 11 14:32 .npm
but /root/ itself is rwx------
# ls -la / | grep root$
drwx------ 6 root root 4096 May 11 14:32 root
It will let nobody in. Even if they has some folders they have right to
read inside.
Meanwhile if I do
# cd ~
# npm install matrix-appservice-irc --global
It gives another error:
npm WARN npm npm does not support Node.js v10.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN deprecated request at 2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/matrix-org/node-irc.git
npm ERR!
npm ERR! fatal: cannot come back to cwd: Permission denied
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-05-11T14_46_17_842Z-debug.log
And I guess I should really do it as a root, because when I did it as a
uesr, it finally tried to install all the stuff into /usr/local/lib that
has no write access rights for common users.
Or if it is not supposed to be run as a root, I would expect
an error message in this case.
I do not know what solution is right, but it does not work this way for
sure.
-- System Information:
Debian Release: 10.3
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.19.0-6-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages npm depends on:
ii ca-certificates 20190110
ii node-abbrev 1.1.1-1
ii node-ansi 0.3.0-3
ii node-ansi-regex 3.0.0-1
ii node-ansistyles 0.1.3-1
ii node-aproba 1.2.0-1
ii node-archy 1.0.0-2
ii node-bluebird 3.5.1+dfsg2-2
ii node-boxen 1.2.2-1
ii node-cacache 11.3.2-2
ii node-call-limit 1.1.0-1
ii node-chownr 1.1.1-1
ii node-config-chain 1.1.11-1
ii node-detect-indent 5.0.0-1
ii node-detect-newline 2.1.0-1
ii node-editor 1.0.0-1
ii node-encoding 0.1.12-2
ii node-errno 0.1.4-1
ii node-from2 2.3.0-1
ii node-fs-vacuum 1.2.10-2
ii node-fs-write-stream-atomic 1.0.10-4
ii node-glob 7.1.3-2
ii node-graceful-fs 4.1.11-1
ii node-gyp 3.8.0-6
ii node-has-unicode 2.0.1-2
ii node-hosted-git-info 2.7.1-1
ii node-iferr 1.0.2-1
ii node-import-lazy 3.0.0.REALLY.2.1.0-1
ii node-inflight 1.0.6-1
ii node-inherits 2.0.3-1
ii node-ini 1.3.5-1
ii node-is-npm 1.0.0-1
ii node-json-parse-better-errors 1.0.2-2
ii node-jsonstream 1.3.2-1
ii node-latest-version 3.1.0-1
ii node-lazy-property 1.0.0-3
ii node-libnpx 10.2.0+repack-1
ii node-lockfile 1.0.4-1
ii node-lru-cache 5.1.1-4
ii node-mississippi 3.0.0-1
ii node-mkdirp 0.5.1-1
ii node-move-concurrently 1.0.1-2
ii node-nopt 3.0.6-3
ii node-normalize-package-data 2.4.0-1
ii node-npm-package-arg 6.0.0-2
ii node-npmlog 4.1.2-1
ii node-once 1.4.0-3
ii node-opener 1.4.3-1
ii node-osenv 0.1.5-1
ii node-path-is-inside 1.0.2-1
ii node-promise-inflight 1.0.1-1
ii node-promzard 0.3.0-1
ii node-qw 1.0.1-1
ii node-read 1.0.7-1
ii node-read-package-json 2.0.13-1
ii node-request 2.88.1-2
ii node-resolve-from 4.0.0-1
ii node-retry 0.10.1-1
ii node-rimraf 2.6.2-1
ii node-safe-buffer 5.1.2-1
ii node-semver 5.5.1-1
ii node-semver-diff 2.1.0-2
ii node-sha 2.0.1-1
ii node-slide 1.1.6-2
ii node-sorted-object 2.0.1-1
ii node-ssri 5.2.4-2
ii node-stream-iterate 1.2.0-4
ii node-strip-ansi 4.0.0-1
ii node-tar 4.4.6+ds1-3
ii node-text-table 0.2.0-2
ii node-uid-number 0.0.6-1
ii node-unique-filename 1.1.0+ds-2
ii node-unpipe 1.0.0-1
ii node-validate-npm-package-name 3.0.0-1
ii node-which 1.3.0-2
ii node-wrappy 1.0.2-1
ii node-write-file-atomic 2.3.0-1
ii node-xdg-basedir 3.0.0-1
ii nodejs 10.19.0~dfsg1-1
npm recommends no packages.
npm suggests no packages.
-- no debconf information
More information about the Pkg-javascript-devel
mailing list