npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Cannot install relative filesystem package after package-lock has been generated

What I Wanted to Do

I have an example folder inside my repository, which installs the package from the parent directory via npm install ...

This has generally worked fine, but I have recently noticed that trying to run npm install from the example no longer works.

What Happened Instead


npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename ‘/Users/glen/Development/GitHub/glenjamin/npm-lock-bug/example/node_modules/.staging/npm-lock-bug-c02b14f3/node_modules/ajv’ -> ‘/Users/glen/Development/GitHub/glenjamin/npm-lock-bug/example/node_modules/.staging/ajv-d8b09fad’
npm ERR! enoent This is related to npm not being able to find a file.

Reproduction Steps

mkdir npm-lock-bug
cd npm-lock-bug
npm init
npm i request
mkdir example
cd example
npm init
npm i ..
rm -rf node_modules
npm i

# install will continue to fail unless I do
rm package-lock.json
npm i


Platform Info

$ npm --versions
{ example: '1.0.0',
  npm: '6.4.1',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.13.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }
$ node -p process.platform

Looks related: