question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

e2e:docker failed to install npm@5 (aka 'latest') which caused errors cleaning cache

See original GitHub issue

I’ve been running in to versions of this issue for months now.

The Issue

I run a fork for my company and I like to make sure we’re still passing all the tests from CRA after doing a pull. When I run yarn run e2e:docker it fails when running npm cache clean || npm cache verify because it seems like it will not install npm@5. I’m currently merging all the changes up to this past Friday.

In the past I’ve edited all the e2e test files with rm -rf ~/.npm before any npm cache clean commands to make the tests even run, but decided to figure out the issue once and for all. That said, it seems like no one else runs in to this issue or must run the tests without Docker.

While figuring this out I’ve ruled out that my fork is the issue. The problem seems to be how npm is installed inside the docker container.

Steps

I removed all copies of the node:6 docker images I had and ran yarn run e2e:docker --test-suite=kitchensink --interactive and I had problems running npm cache clean and npm cache verify.

Below is a snippet of the log editing which shows that npm@5.6.x was installed however the system still uses npm@3 which causes the first commands of the e2e scripts to fail.

<snip />
/home/node/create-react-app
+ mv /var/create-react-app/patch .
+ git apply patch
+ rm patch
+ node --version
v6.12.3
+ npm --version
3.10.10
+ set +x
+ cd ..
+ root_path=/home/node/create-react-app
+ EXPECTED='packages/react-error-overlay/fixtures/bundle.mjs
packages/react-error-overlay/fixtures/bundle.mjs.map
packages/react-error-overlay/fixtures/bundle_u.mjs
packages/react-error-overlay/fixtures/bundle_u.mjs.map
tasks/e2e-simple.sh'
++ git grep -l PATENTS
+ ACTUAL='packages/react-error-overlay/fixtures/bundle.mjs
packages/react-error-overlay/fixtures/bundle.mjs.map
packages/react-error-overlay/fixtures/bundle_u.mjs
packages/react-error-overlay/fixtures/bundle_u.mjs.map
tasks/e2e-simple.sh'
+ '[' 'packages/react-error-overlay/fixtures/bundle.mjs
packages/react-error-overlay/fixtures/bundle.mjs.map
packages/react-error-overlay/fixtures/bundle_u.mjs
packages/react-error-overlay/fixtures/bundle_u.mjs.map
tasks/e2e-simple.sh' '!=' 'packages/react-error-overlay/fixtures/bundle.mjs
packages/react-error-overlay/fixtures/bundle.mjs.map
packages/react-error-overlay/fixtures/bundle_u.mjs
packages/react-error-overlay/fixtures/bundle_u.mjs.map
tasks/e2e-simple.sh' ']'
+ hash npm
+ npm i -g npm@latest
/home/node/.npm/bin/npm -> /home/node/.npm/lib/node_modules/npm/bin/npm-cli.js
/home/node/.npm/bin/npx -> /home/node/.npm/lib/node_modules/npm/bin/npx-cli.js
/home/node/.npm/lib
`-- npm@5.6.0
  +-- abbrev@1.1.1
  +-- ansi-regex@3.0.0
  +-- ansicolors@0.3.2
  +-- ansistyles@0.1.3
  +-- aproba@1.2.0
  +-- archy@1.0.0
  +-- bin-links@1.1.0
  +-- bluebird@3.5.1
<snip />
  | `-- builtins@1.0.3
  +-- which@1.3.0
  | `-- isexe@2.0.0
  +-- worker-farm@1.5.1
  | +-- errno@0.1.4
  | | `-- prr@0.0.0
  | `-- xtend@4.0.1
  +-- wrappy@1.0.2
  `-- write-file-atomic@2.1.0

+ npm cache clean
npm ERR! Linux 4.9.60-linuxkit-aufs
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "cache" "clean"
npm ERR! node v6.12.3
npm ERR! npm  v3.10.10

npm ERR! May not delete: /home/node/.npm/bin
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/node/create-react-app/npm-debug.log
+ npm cache verify
npm ERR! Usage: npm cache add <tarball file>
npm ERR! npm cache add <folder>
npm ERR! npm cache add <tarball url>
npm ERR! npm cache add <git url>
npm ERR! npm cache add <name>@<version>
npm ERR! npm cache ls [<path>]
npm ERR! npm cache clean [<pkg>[@<version>]]
++ set +x
e2e-simple.sh: ERROR! An error was encountered executing line 82.
Cleaning up.
yarn config v1.3.2
success Set "registry" to "https://registry.yarnpkg.com".
Done in 0.06s.
Exiting with error.

✘ Job failes
node@e6cf2934579b:~/create-react-app$ npm -v
3.10.10
node@e6cf2934579b:~/create-react-app$ cd ~/.npm/
node@e6cf2934579b:~/.npm$ ls
bin  etc
node@e6cf2934579b:~/.npm$ cd bin/
node@e6cf2934579b:~/.npm/bin$ ls
npm  npx
node@e6cf2934579b:~/.npm/bin$ ./npm -v
bash: ./npm: No such file or directory
node@e6cf2934579b:~/.npm/bin$ ls -la
total 8
drwxr-xr-x 2 node node 4096 Feb 13 19:33 .
drwxr-xr-x 4 node node 4096 Feb 13 19:33 ..
lrwxrwxrwx 1 node node   38 Feb 13 19:33 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxrwxrwx 1 node node   38 Feb 13 19:33 npx -> ../lib/node_modules/npm/bin/npx-cli.js
<snip />
node@e6cf2934579b:~/.npm$ cd
node@e6cf2934579b:~$ which npm
/usr/local/bin/npm
node@e6cf2934579b:~$ cd /usr/local/bin/npm
bash: cd: /usr/local/bin/npm: Not a directory
node@e6cf2934579b:~$ cd /usr/local/bin/
node@e6cf2934579b:/usr/local/bin$ ls -la | grep npm
lrwxrwxrwx 1 root staff       38 Jan  2 18:24 npm -> ../lib/node_modules/npm/bin/npm-cli.js
node@e6cf2934579b:/usr/local/bin$ cd ../lib/node_modules/
node@e6cf2934579b:/usr/local/lib/node_modules$ ls
npm
node@e6cf2934579b:/usr/local/lib/node_modules$ cd npm/
node@e6cf2934579b:/usr/local/lib/node_modules/npm$ ls
AUTHORS  CHANGELOG.md  CONTRIBUTING.md  LICENSE  Makefile  README.md  appveyor.yml  bin  changelogs  cli.js  configure  doc  html  lib  make.bat  man  node_modules  package.json  scripts
node@e6cf2934579b:/usr/local/lib/node_modules/npm$ cat package.json
{
  "version": "3.10.10",
  "name": "npm",
  "description": "a package manager for JavaScript",
  "keywords": [
    "install",
    "modules",
    "package manager",
    "package.json"
<snip />
node@e6cf2934579b:/usr/local/lib/node_modules/npm$

I found this issue from docker-node talking about problems installing npm@5 on existing images. Running a variant of the suggested command on that issue from interactive mode did not work (npm i -g npm3 && npm3 -g uninstall npm && npm3 i -g npm@5).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gaearoncommented, Feb 18, 2018

To set expectations: I don’t think any of us use e2e:docker script in practice right now. There are indeed issues with it.

0reactions
bugzpoddercommented, Jun 17, 2018

I’ve been running e2e:docker tests fine locally. Please file a new issue if you are still experiencing problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Updating npm fails · Issue #449 · nodejs/docker-node - GitHub
Self-updating npm to the latest fails $ docker run -it node:8 bash -xc "npm install npm@latest -g; npm --version" + npm install npm@latest...
Read more >
node.js - When I run `npm install`, it returns with `ERR! code ...
json file, and ran npm cache clean --force , but it didn't work. My npm version is 5.3.0. The error: npm ERR! code...
Read more >
Common errors | npm Docs
Some strange issues can be resolved by simply running npm cache clean and trying again. If you are having trouble with npm install...
Read more >
How to clear your cache in npm
If you ever get weird errors in npm like Please run npm cache clean you may need to clean or refresh your npm...
Read more >
How to install the latest versions of NodeJS and NPM?
sudo npm cache clean -f sudo npm install -g n sudo n 0.xx.x // here is the version what you want.. This command...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found