npm ci creates wrong symlink

priority:medium
triaged
cli
help-wanted

(Satoshi) #1

What I Wanted to Do

deep “file:” dependencies

What Happened Instead

npm ci creates wrong symlink

Reproduction Steps

attached in:

Details

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘ci’ ]
2 info using npm@6.1.0
3 info using node@v10.7.0
4 verbose npm-session ba4ee4ff240c04d2
5 info prepare initializing installer
6 verbose prepare starting workers
7 verbose prepare installation prefix: /tmp/p/c
8 verbose prepare using package-lock.json
9 verbose checkLock verifying package-lock data
10 silly tree LogicalTree {
10 silly tree name: ‘c’,
10 silly tree version: ‘1.0.0’,
10 silly tree address: ‘’,
10 silly tree optional: false,
10 silly tree dev: false,
10 silly tree bundled: false,
10 silly tree resolved: undefined,
10 silly tree integrity: undefined,
10 silly tree dependencies:
10 silly tree Map {
10 silly tree ‘b’ => LogicalTree {
10 silly tree name: ‘b’,
10 silly tree version: ‘file:…/b’,
10 silly tree address: ‘b’,
10 silly tree optional: false,
10 silly tree dev: false,
10 silly tree bundled: false,
10 silly tree resolved: undefined,
10 silly tree integrity: undefined,
10 silly tree dependencies: [Map],
10 silly tree requiredBy: [Set] } },
10 silly tree requiredBy: Set {} }
11 info prepare Done in 0.026s
12 verbose extractTree extracting dependencies to node_modules/
13 silly extractTree b@/tmp/p/b -> /tmp/p/c/node_modules/b (symlink)
14 silly extractTree a@/tmp/p/a -> /tmp/p/c/node_modules/b/node_modules/a (symlink)
15 info extractTree Done in 0.008s
16 verbose updateJson updating json deps to include _from
17 verbose teardown shutting down workers.
18 info teardown Done in 0s
19 verbose stack Error: ENOENT: no such file or directory, open ‘/tmp/p/c/node_modules/b/node_modules/a/package.json’
20 verbose cwd /tmp/p/c
21 verbose Linux 4.15.0-29-generic
22 verbose argv “/usr/local/bin/node” “/usr/local/bin/npm” “ci”
23 verbose node v10.7.0
24 verbose npm v6.1.0
25 error path /tmp/p/c/node_modules/b/node_modules/a/package.json
26 error code ENOENT
27 error errno -2
28 error syscall open
29 error enoent ENOENT: no such file or directory, open ‘/tmp/p/c/node_modules/b/node_modules/a/package.json’
30 error enoent This is related to npm not being able to find a file.
31 verbose exit [ -2, true ]

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘ci’ ]
2 info using npm@6.3.0
3 info using node@v10.8.0
4 verbose npm-session d2738c3df0e1f0cf
5 info prepare initializing installer
6 verbose prepare starting workers
7 verbose prepare installation prefix: /home/nakagawa/tmp/p/c
8 verbose prepare using package-lock.json
9 verbose checkLock verifying package-lock data
10 silly tree LogicalTree {
10 silly tree name: ‘c’,
10 silly tree version: ‘1.0.0’,
10 silly tree address: ‘’,
10 silly tree optional: false,
10 silly tree dev: false,
10 silly tree bundled: false,
10 silly tree resolved: undefined,
10 silly tree integrity: undefined,
10 silly tree dependencies:
10 silly tree Map {
10 silly tree ‘b’ => LogicalTree {
10 silly tree name: ‘b’,
10 silly tree version: ‘file:…/b’,
10 silly tree address: ‘b’,
10 silly tree optional: false,
10 silly tree dev: false,
10 silly tree bundled: false,
10 silly tree resolved: undefined,
10 silly tree integrity: undefined,
10 silly tree dependencies: [Map],
10 silly tree requiredBy: [Set] } },
10 silly tree requiredBy: Set {} }
11 info prepare Done in 0.028s
12 verbose extractTree extracting dependencies to node_modules/
13 silly extractTree b@/home/nakagawa/tmp/p/b -> /home/nakagawa/tmp/p/c/node_modules/b (symlink)
14 silly extractTree a@/home/nakagawa/tmp/p/a -> /home/nakagawa/tmp/p/c/node_modules/b/node_modules/a (symlink)
15 info extractTree Done in 0.009s
16 verbose updateJson updating json deps to include _from
17 verbose teardown shutting down workers.
18 info teardown Done in 0.001s
19 verbose stack Error: ENOENT: no such file or directory, open ‘/home/nakagawa/tmp/p/c/node_modules/b/node_modules/a/package.json’
20 verbose cwd /home/nakagawa/tmp/p/c
21 verbose Linux 4.15.0-30-generic
22 verbose argv “/usr/local/bin/node” “/usr/local/bin/npm” “ci”
23 verbose node v10.8.0
24 verbose npm v6.3.0
25 error path /home/nakagawa/tmp/p/c/node_modules/b/node_modules/a/package.json
26 error code ENOENT
27 error errno -2
28 error syscall open
29 error enoent ENOENT: no such file or directory, open ‘/home/nakagawa/tmp/p/c/node_modules/b/node_modules/a/package.json’
30 error enoent This is related to npm not being able to find a file.
31 verbose exit [ -2, true ]

Platform Info

$ npm --versions
{ c: '1.0.0',
  npm: '6.1.0',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.32.0',
  node: '10.7.0',
  openssl: '1.1.0h',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.22.0',
  v8: '6.7.288.49-node.15',
  zlib: '1.2.11' }

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

<!-- paste output here -->

(Kat Marchán) #2

Triage Notes: This might be a duplicate of npm ci fails with recursive local dependencies


(Wade Johnson) #3

I just ran into this problem today. The symlink that npm ci creates for a recursive local dependency doesn’t have enough ../s to get high enough in the tree to follow the correct path to the package.
npm i works totally fine, though, so I switched our build process back to that command to avoid failing builds.