mhart / alpine-node

Minimal Node.js Docker Images built on Alpine Linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm fails with isArray module not found after upgrading npm

c0debreaker opened this issue · comments

When using non alpine image, updating npm works. However, when using alpine, the updated npm fails with cannot find module isArray.

Dockerfile

FROM mhart/alpine-node:6

Then I go interactively

docker exec -it node-alpine-test /bin/sh

And I update npm

/ # npm -v
3.10.10

/ # npm install -g npm@latest
/usr/bin/npx -> /usr/lib/node_modules/npm/bin/npx-cli.js
/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
- asap@2.0.5 node_modules/npm/node_modules/asap
- fstream@1.0.10 node_modules/npm/node_modules/fstream
- balanced-match@0.4.2 node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match
- concat-map@0.0.1 node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map
- brace-expansion@1.1.6 node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion
............
...........
...........
I removed the remaining output

Then I execute npm -v

/ # npm -v
module.js:478
    throw err;
    ^

Error: Cannot find module 'isarray'
    at Function.Module._resolveFilename (module.js:476:15)
    at Function.Module._load (module.js:424:25)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:32:15)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)

mhart/alpine-node:6 already has npm v3.10.10

Ah, sorry – I was confused about what you were doing. Ignore my last comment.

It may just be permissions issues – you can read more about that here: npm/npm#17851

Also might be a Docker filesystem issue?

I suspect you're running into this issue with npm:

npm/npm#16807 (comment)

So try what it suggests there:

FROM mhart/alpine-node:6
RUN npm i -g npm3 && npm3 -g uninstall npm
RUN npm3 i -g npm@latest
RUN npm -v

Ok, I'll try those. Thanks!