`npm i` tries to `git checkout` (a deleted branch)

priority:medium
help-wanted
cli
triaged

(Ardeshir81) #1

What I Wanted to Do

I had a git branch in my project (named 1.7.1). I npm i ed on it, and pushed the result (changes in package-lock.json), I made a tag out of it, and then I checked out my master. I deleted 1.7.1 branch (local & origin, both) & tried to npm i on my master.

What Happened Instead

I encountered error:

npm ERR! code 1
npm ERR! Command failed: /usr/bin/git checkout 1.7.1
npm ERR! error: pathspec ‘1.7.1’ did not match any file(s) known to git.

more verbose output:


npm info lifecycle ubiprocess-gateway-web-frontend@1.7.3-SNAPSHOT~preinstall: ubiprocess-gateway-web-frontend@1.7.3-SNAPSHOT

npm verb stack Error: Command failed: /usr/bin/git checkout 1.7.1
npm verb stack error: pathspec ‘1.7.1’ did not match any file(s) known to git.
npm verb stack
npm verb stack at ChildProcess.exithandler (child_process.js:275:12)
npm verb stack at emitTwo (events.js:126:13)
npm verb stack at ChildProcess.emit (events.js:214:7)
npm verb stack at maybeClose (internal/child_process.js:925:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm verb cwd /home//workspace/ubiprocess-gateway-web-client
npm verb Linux 4.15.0-30-generic
npm verb argv “/home//.nvm/versions/node/v8.11.3/bin/node” “/home//.nvm/versions/node/v8.11.3/bin/npm” “i” “–verbose”
npm verb node v8.11.3
npm verb npm v6.3.0
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git checkout 1.7.1
npm ERR! error: pathspec ‘1.7.1’ did not match any file(s) known to git.
npm ERR!
npm verb exit [ 1, true ]

Reproduction Steps

Unfortunately my project’s git repository isn’t available, but this is the exact same things happened:

  • I checked out a branch (let’s name it 1.7.1)
  • I npm update <some_libs> ed & then npm i ed in 1.7.1
  • I pushed result (changed package-lock.json) to 1.7.1’s origin
  • I made a tag out of my 1.7.1 (named it v1.7.1 btw)
  • I checked out my master
  • I removed git branch 1.7.1 local & git branch 1.7.1 origin
  • I changed my app’s version in package.json
  • I npm update <some_libs> ed & then npm i ed in master
    and thats where I encountered error

Details

I also tried npm cache verify & removing my node_modules folder.

in my npm-debug.log, line 20, it indicates that it’s trying to checkout 1.7.1 on some other (sub)project. I also recently removed 1.7.1 on that (sub)project. also there is nothing about 1.7.1 nor on my package.json niether in my package-lock.json, and not in my node_modules (as I told you, I tried removing node_modules and npm i ing again)

P.S after removing node_modules, npm i ing does not produce error, npm i ing again produces error.

Platform Info

$ npm --versions
<!-- paste output here -->
{ 'ubiprocess-gateway-web-frontend': '1.7.3-SNAPSHOT',
  npm: '6.3.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.11.3',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' }


$ node -p process.platform
<!-- paste output here -->
linux

Thanks!

2018-08-12T13_19_13_227Z-debug.log (121.1 KB)


(Ardeshir81) #2

package.json (4.1 KB)
package-lock.json (593.1 KB)


(system) #3

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