global install of shrinkwrapped package fails with ENOENT: no such file or directory, rename


(Myk Melez) #1

What I Wanted to Do

I wanted to globally install a shrinkwrapped package with a dependency.

What Happened Instead

The install process failed with “ENOENT: no such file or directory, rename”.

Reproduction Steps

mkdir foo && cd foo && npm init -y && npm add chalk && npm shrinkwrap && npm install -g

Example is also available as a repository:

git clone && cd test-shrinkwrap && npm install && npm shrinkwrap && npm install -g

Note that I use “chalk” as the dependency in this example, but the issue isn’t specific to “chalk”. Any dependency will do, even “npm” itself:

mkdir foo && cd foo && npm init -y && npm add npm && npm shrinkwrap && npm install -g


Originally tested on npm 5.8.0 (macOS), 5.7.1 (Windows, Linux) with Node v9.10.1 (macOS), v8.4.0 (Windows, Linux).

Current output of npm versions on macOS, where I can still reproduce the problem:

{ 'test-shrinkwrap': '0.1.0',
  npm: '6.1.0',
  ares: '1.14.0',
  cldr: '33.0',
  http_parser: '2.8.0',
  icu: '61.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.29.0',
  node: '10.3.0',
  openssl: '1.1.0h',
  tz: '2018c',
  unicode: '10.0',
  uv: '1.20.3',
  v8: '6.6.346.32-node.9',
  zlib: '1.2.11' }

Someone else has reported reproducing on “npm@5.5.1, npm@5.8.0, npm@5.10.0, npm@6.0.0, and npm@6.0.1.”

I also filed this as a GitHub issue. Here’s an npm-debug.log file.

ENOENT when globally installing multiple folders
"Auto Closing" issues on this new platform
(Kat Marchán) #2

Confirming that this definitely does reproduce the error for me on OSX and npm@release-next. Thanks for the repro! This is super helpful.

(Rebecca Turner) #4

Hmm, logs show that it’s not producing fetch and extract steps when decomposing the add actions. It should have:

npm sill decomposeActions fetch color-name@1.1.3
npm sill decomposeActions extract color-name@1.1.3

Ah, but this only happens when globally installing a directory with a shrinkwrap. Ok, and that’s because it shouldn’t be generating add actions at all, because it was symlinked and the symlinked verison should be fine.

FunFact™: If you rm -rf your node_modules from the directory you’re installing, npm will both succesfully create the global link and create the node_modules.

(system) #5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

(Kat Marchán) #6

(Kat Marchán) #7

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.