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

[BUG] npm v7 not using EXDEV aware move so failes upgrade running in docker #2182

Closed
tlbdk opened this issue Nov 16, 2020 · 2 comments
Closed
Assignees
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@tlbdk
Copy link

tlbdk commented Nov 16, 2020

Current Behavior:

npm install failes in docker because it's doing EXDEV unaware rename, docker is using overlay filesystems so the new file will be in a new mount point even if it's in the same folder.

Step #1: npm notice 
Step #1: npm notice New patch version of npm available! 7.0.8 -> 7.0.11
Step #1: npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.0.11>
Step #1: npm notice Run `npm install -g [email protected]` to update!
Step #1: npm notice 
Step #1: npm ERR! code EXDEV
Step #1: npm ERR! syscall rename
Step #1: npm ERR! path /opt/node-v15.2.1-linux-x64/lib/node_modules/npm
Step #1: npm ERR! dest /opt/node-v15.2.1-linux-x64/lib/node_modules/.npm-dMIHb7ie
Step #1: npm ERR! errno -18
Step #1: npm ERR! EXDEV: cross-device link not permitted, rename '/opt/node-v15.2.1-linux-x64/lib/node_modules/npm' -> '/opt/node-v15.2.1-linux-x64/lib/node_modules/.npm-dMIHb7ie'
Step #1: 
Step #1: npm ERR! A complete log of this run can be found in:
Step #1: npm ERR!     /root/.npm/_logs/2020-11-16T19_13_41_120Z-debug.log
Step #1: The command '/bin/sh -c /opt/node-v$NODE_VERSION-linux-x64/bin/npm install -g npm@$NPM_VERSION' returned a non-zero code: 238

This was fixed before in an older version of npm:

Expected Behavior:

Be able to upgrade/downgrade npm while running in a docker image with npm preinstalled by using EXDEV aware rename.

Steps To Reproduce:

# Extract nodejs and npm in layer
RUN tar -xJf "node-v15.2.1-linux-x64.tar.xz" -C /opt --no-same-owner 
# Install npm in a new layer
RUN /opt/node-v15.2.1-linux-x64/bin/npm install -g [email protected]

Environment:

  • OS: Ubuntu 20.04 docker image
  • Node: 15.2.1
  • npm: 7.0.8
@tlbdk tlbdk added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Nov 16, 2020
@tlbdk
Copy link
Author

tlbdk commented Nov 16, 2020

A workaround for this is to either force docker to fetch the files to same layer:

find . -type f -exec touch {} +

Or do nodejs extract and npm upgrade in same step:
https://github.com/connectedcars/docker-node/pull/43/files

@darcyclarke
Copy link
Contributor

darcyclarke commented Jan 15, 2021

@tlbdk thanks for flagging this. We should have a patch out here shortly (ie. v7.4.2 should resolve this)

@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label Jan 15, 2021
@darcyclarke darcyclarke self-assigned this Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

2 participants