Skip to content
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

node:15.0.1 Docker container: npm fails to update as instructed by npm #3036

Closed
rwoll opened this issue Oct 24, 2020 · 1 comment
Closed

Comments

@rwoll
Copy link

rwoll commented Oct 24, 2020

  • Node.js Version: 15.0.1
  • OS: macOS + Docker
  • Scope (install, code, runtime, meta, other?): other
  • Module (and version) (if relevant): N/A

Updating npm as instructed by npm fails in v15.0.1 Docker container. See for repro: npm/cli#2031.

Posting here to help triage where the issue lies and in which repo to report.

@gireeshpunathil
Copy link
Member

able to easily recreate:

directly inside the image:

#docker run -it node:15.0.1 bash
root@d8377a56e643:/# node   
Welcome to Node.js v15.0.1.
Type ".help" for more information.
> require('fs').renameSync('/usr/local/lib/node_modules/npm', '/usr/local/lib/node_modules/.npm-i9nnxROI')
Uncaught:
Error: EXDEV: cross-device link not permitted, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'
    at Object.renameSync (node:fs:772:3) {
  errno: -18,
  syscall: 'rename',
  code: 'EXDEV',
  path: '/usr/local/lib/node_modules/npm',
  dest: '/usr/local/lib/node_modules/.npm-i9nnxROI'
}
> 
(To exit, press Ctrl+C again or Ctrl+D or type .exit)
> 

using a small C program, that essentially does the same thing:

root@d8377a56e643:/# cat foo.cc
#include <stdio.h>
#include <errno.h>

int main() {
  int ret = rename("/usr/local/lib/node_modules/npm", "/usr/local/lib/node_modules/.npm-i9nnxROI");
  fprintf(stderr, "%d %d\n", ret, errno);
}
root@d8377a56e643:/# cc foo.cc
root@d8377a56e643:/# ./a.out
-1 18
root@d8377a56e643:/# 

tracing the process for the rename syscall:

root@d8377a56e643:/# strace -e rename ./a.out
rename("/usr/local/lib/node_modules/npm", "/usr/local/lib/node_modules/.npm-i9nnxROI") = -1 EXDEV (Invalid cross-device link)
-1 18
+++ exited with 0 +++
root@d8377a56e643:/# 

so looks like it is an issue with the version of the base OS that this image uses.

/cc @nodejs/docker to see if they know any issues in this regard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants