-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command "npm install -g" causes "ERR! Cannot read property 'path' of null" #437
Comments
I think this is due to run npm as root. You should run it as the |
I can't seem to get this to work either. I am trying with this dockerfile: FROM node:latest
USER node
RUN npm install -g elm
CMD ['elm', '--version'] However I still get this error:
Am I using the Note: I am able to get it working by overriding the npm install dir: FROM node:latest
USER node
RUN mkdir ~/.npm-global
ENV NPM_CONFIG_PREFIX=~/.npm-global
RUN npm install -g elm
CMD ['elm', '--version'] |
Hmm, odd. Should we make |
There is #479 (comment). PR welcome! |
Yeah, it is definitely awkward. @SimenB does this folder even exist before running npm to begin with? |
Ooooh it does!!! |
Yup. $ docker run node:latest ls -la /usr/local/lib/node_modules/npm
total 192
drwxrwxr-x 11 500 500 4096 Jul 20 20:59 .
drwxrwxr-x 3 500 500 4096 Jul 20 20:59 ..
drwxrwxr-x 2 500 500 4096 Jul 20 20:59 .github
-rw-rw-r-- 1 500 500 2813 Jul 19 15:54 .mailmap
-rw-rw-r-- 1 500 500 539 Jul 11 00:43 .npmignore
-rw-rw-r-- 1 500 500 1297 Jul 19 15:54 .travis.yml
-rw-rw-r-- 1 500 500 18878 Jul 19 15:54 AUTHORS
-rw-rw-r-- 1 500 500 51191 Jul 19 15:54 CHANGELOG.md
-rw-rw-r-- 1 500 500 4474 Jul 19 15:54 CONTRIBUTING.md
-rw-rw-r-- 1 500 500 9742 May 29 11:46 LICENSE
-rw-rw-r-- 1 500 500 5287 Jul 19 15:54 Makefile
-rw-rw-r-- 1 500 500 4719 Jul 19 15:54 README.md
-rw-rw-r-- 1 500 500 7997 Jul 19 15:54 TROUBLESHOOTING.md
-rw-rw-r-- 1 500 500 959 Jul 19 15:54 appveyor.yml
drwxrwxr-x 3 500 500 4096 Jul 20 20:59 bin
drwxrwxr-x 2 500 500 4096 Jul 20 20:59 changelogs
-rwxrwxr-x 1 500 500 521 May 29 11:46 configure
drwxrwxr-x 6 500 500 4096 Jul 20 20:59 doc
drwxrwxr-x 4 500 500 4096 Jul 20 20:59 html
drwxrwxr-x 8 500 500 4096 Jul 20 20:59 lib
-rw-rw-r-- 1 500 500 156 May 29 11:46 make.bat
drwxrwxr-x 5 500 500 4096 Jul 20 20:59 man
drwxrwxr-x 99 500 500 4096 Jul 20 20:59 node_modules
-rw-rw-r-- 1 500 500 6208 Jul 19 15:54 package.json
drwxrwxr-x 2 500 500 4096 Jul 20 20:59 scripts |
You beat me to it!!! I was going to post the same! |
Doing So either we should just set a npm prefix for the node-user somehow (.npmrc in its |
Can we configure the |
That's the prefix option. |
@SimenB we can move the whole global dependencies to the user space with the prefix or we can figure a way to make linked binary work in |
Setting
Sure. |
I like the prefix better as well but the other option is potentially less disruptive |
I am unable to install protractor globally. facing permission issue even though i am installing as root |
bonjour a tous, moi je pense avoir le même problème, je débute en node.js, et je voulais installer express-generator ( avec npm install express-generator -g) mais ça me donne toujours le même résultat (affiché en bas du message ) si quelqu'un peux m'aider merci path /Users/myname/.npm-packages/lib/node_modules/express-generator npm ERR! A complete log of this run can be found in: |
Les paths ci-haut semble être des paths de Mac OS. Utilisez-vous docker pour node? |
merci pour votre réponse Laurent , aprés avoir regardé sur le net ce que veux dire docker, car ça me dis rien, je pense que je l'ai pas utlisé, et effectivement c'est des paths de Mac OS |
We have no specific solution for this problem of rights? |
The solution mentioned here works. #437 (comment) In addition, npm added the |
It is part of documentation. |
I was facing this issue while building the Angular 6 image with Docker (v18.09.0). The Proxy variables of node and Docker environment were causing the problem. The solution is to reset Finally, my
I hope this helps someone. |
Hi, I am facing the same issue. I am trying to install globally
/ # npm i -g react
+ react@16.8.6
added 7 packages from 3 contributors in 0.826s
/ # npm rm -g react
removed 7 packages in 0.15s
/ # npm i -g elm
/usr/local/bin/elm -> /usr/local/lib/node_modules/elm/bin/elm
> elm@0.19.0-bugfix6 install /usr/local/lib/node_modules/elm
> binwrap-install
ERR Error extracting https://github.com/elm/compiler/releases/download/0.19.0/binaries-for-linux.tar.gz - Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/elm/unpacked_bin'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elm@0.19.0-bugfix6 install: `binwrap-install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the elm@0.19.0-bugfix6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-04-09T16_38_50_957Z-debug.log I tried to install globally a package using yarn (coming by default with the Docker image):
I think the problem is not with the Docker image itself but with the package manager. |
My company does scans for vulnerabilities in our Docker images. We kept failing because of
|
Hi there!
This was resolved by changing the permission in
But changing the permission of |
@nipan09 Try adding |
`(base) programmer@programmer-Lenovo-ideapad-320-15ISK:~$ npm install -g expo-cli@3 npm ERR! code EACCES npm ERR! A complete log of this run can be found in: I am getting this error when i try to use command |
This Solution worked for me. Thanks @nikhilbchilwant |
attempting to enhance this image by installing Elm globally but encountering issues. It would appear that the installation process for
npm
is user500
and owns and restricts access to/usr/local/lib/node_modules
by default. Seems like an unnecessary constraint to impose on an already isolated environment.Investigation revealed:
and
where
The text was updated successfully, but these errors were encountered: