npm i github:user/repo or githubuser/repo does not work as expected

cli
triaged

(Daniel Ruf) #1

What I Wanted to Do

I wanted to install a package from GitHub.

What Happened Instead

The package was installed one or multiple directories upwards.

Reproduction Steps

npm i pattern-lab/starterkit-twig-demo && ll

Details

Platform Info

$ npm --versions
{ 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.33.0',
  node: '10.11.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.0',
  v8: '6.8.275.32-node.28',
  zlib: '1.2.11' }

(Lars Willighagen) #2

Seems to work fine for me… Is the output of npm prefix the directory you expect it to be installed? And do normal packages work properly?


(Kat Marchán) #3

Moving to #support: this bug report is pretty scarce and not terribly actionable. I’ll move it back once there’s reason to believe this is an actual bug and not a misunderstanding.


(Daniel Ruf) #4

Well, this is weird. I did nothing different. Same behavior was reproducible on the macbook of a colleague.
Now it does not happen anymore after several retries.
So there was definitely something changing, but not on my side.
Because with Yarn it worked but npm moved the @ package from GitHub one level up.

But you can still reproduce it with npm init -y && npx @pattern-lab/cli -c patternlab init which will throw Error: ENOENT: no such file or directory, lstat '/Users/druf/projects/patternlab-test3/node_modules/starterkit-twig-demo/dist' as starterkit-twig-demo is added one level upwards.