You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Last alpine image breaks npm install with git+ssh #1378
It looks like NPMv7 npm install wants to use bash, which is not present in alpine image. NPMv6 works fine on lts-alpine.
DIGEST: sha256:97204ef250fa90f8177084ef6d7641ede6d48c4c8acfb30faf3580bee5c59c0b
Is it NPM problem or with some settings connected with latest image?
Log:
npm WARN tarball tarball data for XXX@git+ssh://git@github.com/XXX/XXX.git#hash (null) seems to be corrupted. Trying again.
npm WARN tarball tarball data for XXX@git+ssh://git@github.com/XXX/XXX.git#hash (null) seems to be corrupted. Trying again.
npm notice
npm notice New patch version of npm available! 7.0.2 -> 7.0.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.0.3>
npm notice Run `npm install -g npm@7.0.3` to update!
npm notice
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path bash
npm ERR! errno -2
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
I don't know what package you're trying to install - I'm assuming it is due to some pre-built binary not being available, so it attempts to build from source, which requires bash. Hard to tell without more details, however.
I don't think it's a bug in this image or in npm. I might be wrong though. You should take a look at the logfile after the failure.
It turns out that NPMv7 respects shell config option and NPMv6 does not (in this case).
NPMv6:
damian_koper@X:~/Desktop/npm-test $ docker run -it node:lts-alpine sh
/ # npm -v
6.14.8
/ # npm config ls -l | grep shell
script-shell = null
shell = "bash"
/ # apk add git
OK: 23 MiB in 22 packages
/ # npm i github:damiankoper/piw.git # random repo# WORKS
NPMv7:
damian_koper@X:~/Desktop/npm-test $ docker run -it node:alpine sh
/ # npm -v
7.0.3
/ # npm config ls -l | grep shell
script-shell = null
shell = "bash"
/ # apk add git
OK: 23 MiB in 22 packages
/ # npm i github:damiankoper/piw.git # random repo
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path bash
npm ERR! errno -2
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
Solution for NPMv7:
/app # npm config set shell sh # Should this be added to alpine Dockerfile with NPMv7?
validBefore?true
/ # npm i github:damiankoper/piw.git # random repo
WORKS
Activity
SimenB commentedon Oct 23, 2020
I don't know what package you're trying to install - I'm assuming it is due to some pre-built binary not being available, so it attempts to build from source, which requires
bash. Hard to tell without more details, however.I don't think it's a bug in this image or in npm. I might be wrong though. You should take a look at the logfile after the failure.
damiankoper commentedon Oct 23, 2020
It looks like NPMv7 issue:
npm/cli#2008
npm/cli#2022
So this issue can be closed.
damiankoper commentedon Oct 25, 2020
It turns out that NPMv7 respects
shellconfig option and NPMv6 does not (in this case).NPMv6:
NPMv7:
Solution for NPMv7:
SimenB commentedon Oct 25, 2020
so npm defaults to
bash? They should probably default to.shas that's more portable. We can probably set that config option, tho.Tchoupinax commentedon Nov 9, 2020
I had the same issue (installing package from git) and adding the following line in my Dockerfile fixes the issue. Thanks @damiankoper
Edit: answer to the next comment, yes v15.1.0 solve the issue ^^
nschonni commentedon Nov 9, 2020
Default shell was fixed in NPM and included in the 15.1.0 images