Starting from npm 5, cannot uninstall package, if install source was deleted

triaged
cli
help-wanted
priority:low

(Sergei Vizel) #1

What I Wanted to Do

Tried to run npm rm -g dummy-pkg and expected what package will be removed.

What Happened Instead

NPM show error: ENOENT: no such file or directory, stat '/var/www/dummy-pkg-0.0.1.tgz'

Reproduction Steps

mkdir dummy-pkg
cd dummy-pkg
npm init -y
cd ..
npm pack dummy-pkg
rm -rf dummy-pkg
npm i -g dummy-pkg-0.0.1.tgz
rm dummy-pkg-0.0.1.tgz
npm rm -g dummy-pkg

Details

Error output:

npm ERR! path /var/www/dummy-pkg-0.0.1.tgz
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall stat
npm ERR! enoent ENOENT: no such file or directory, stat '/var/www/dummy-pkg-0.0.1.tgz'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-08-06T05_18_28_338Z-debug.log

/root/.npm/_logs/2018-05-20T16_16_18_499Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'rm',
1 verbose cli   '-g',
1 verbose cli   'dummy-pkg' ]
2 info using npm@6.3.0
3 info using node@v10.6.0
4 verbose npm-session effcf060ec858d3c
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 timing stage:loadCurrentTree Completed in 26ms
8 silly install loadIdealTree
9 silly install cloneCurrentTreeToIdealTree
10 timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
11 silly install loadShrinkwrap
12 timing stage:loadIdealTree:loadShrinkwrap Completed in 3ms
13 silly uninstall loadAllDepsIntoIdealTree
14 silly install loadAllDepsIntoIdealTree
15 silly fetchPackageMetaData error for dummy-pkg@file:../../../var/www/dummy-pkg-0.0.1.tgz ENOENT: no such file or directory, stat '/var/www/dummy-pkg-0.0.1.tgz'
16 timing stage:rollbackFailedOptional Completed in 0ms
17 timing stage:runTopLevelLifecycles Completed in 150ms
18 verbose stack Error: ENOENT: no such file or directory, stat '/var/www/dummy-pkg-0.0.1.tgz'
19 verbose cwd /var/www
20 verbose Linux 4.4.0-127-generic
21 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "rm" "-g" "dummy-pkg"
22 verbose node v10.6.0
23 verbose npm  v6.3.0
24 error path /var/www/dummy-pkg-0.0.1.tgz
25 error code ENOENT
26 error errno -2
27 error syscall stat
28 error enoent ENOENT: no such file or directory, stat '/var/www/dummy-pkg-0.0.1.tgz'
29 error enoent This is related to npm not being able to find a file.
30 verbose exit [ -2, true ]

Platform Info

$ npm --versions
{ npm: '6.3.0',
  ares: '1.14.0',
  cldr: '33.0',
  http_parser: '2.8.0',
  icu: '61.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.32.0',
  node: '10.6.0',
  openssl: '1.1.0h',
  tz: '2018c',
  unicode: '10.0',
  uv: '1.21.0',
  v8: '6.7.288.46-node.13',
  zlib: '1.2.11' }

$ node -p process.platform
linux

(Sergei Vizel) #2

Same with npm@6.4.0