Skip to content

[BUG] Under 6.14.5, having a package.json provokes a 404 when a local dependency's dev dependency is a local scoped package #1480

Closed

Description

@brady-ds

What / Why

  • Despite the fact that the package in question is local, npm install reports:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/… - Not found
npm ERR! 404 
npm ERR! 404  '…' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

When

  • When package C depends on a local package B,
  • When package B has a dev dependency on local package A,
  • When A is a scoped package,
  • When C already has a package-lock.json, and
  • When I run npm install in C's directory.

Where

  • npm/cli

How

Current Behavior

  • As mentioned above, npm install in C's directory gives an error about installing A. The full log for the steps to reproduce is included below:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install' ]
2 info using npm@6.14.5
3 info using node@v13.14.0
4 verbose npm-session f846a2601b25eb00
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall c@1.0.0
7 info lifecycle c@1.0.0~preinstall: c@1.0.0
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 timing stage:loadCurrentTree Completed in 4ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
14 silly install loadShrinkwrap
15 http fetch GET 404 https://registry.npmjs.org/@scope%2fa 1010ms
16 http fetch GET 404 https://registry.npmjs.org/@scope%2fa 522ms
17 silly fetchPackageMetaData error for @scope/a@1.0.0 404 Not Found - GET https://registry.npmjs.org/@scope%2fa - Not found
18 timing stage:rollbackFailedOptional Completed in 1ms
19 timing stage:runTopLevelLifecycles Completed in 1568ms
20 silly saveTree c@1.0.0
20 silly saveTree └── b@file:../b
21 verbose stack Error: 404 Not Found - GET https://registry.npmjs.org/@scope%2fa - Not found
21 verbose stack     at /usr/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:104:15
21 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
22 verbose statusCode 404
23 verbose pkgid @scope/a@1.0.0
24 verbose cwd /…/c
25 verbose Linux 5.3.0-7648-generic
26 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
27 verbose node v13.14.0
28 verbose npm  v6.14.5
29 error code E404
30 error 404 Not Found - GET https://registry.npmjs.org/@scope%2fa - Not found
31 error 404
32 error 404 '@scope/a@1.0.0' is not in the npm registry.
33 error 404 You should bug the author to publish it (or use the name yourself!)
34 error 404 Note that you can also install from a
35 error 404 tarball, folder, http url, or git url.
36 verbose exit [ 1, true ]

Steps to Reproduce

  • In an empty directory, I can reproduce the issue with these commands, where the final npm install is the one that gives the log above:
$ mkdir a b c
$ (cd a; npm init -y --scope scope; npm install)
$ (cd b; npm init -y; npm install --save-dev ../a)
$ (cd c; npm init -y; npm install --save ../b)
# Mimic running `npm install` in a fresh clone, which will have `package.json` but not `node_modules`:
$ (cd c; rm -rf node_modules; npm install)

Expected Behavior

  • The install should succeed, as it does before package.json exists, or as it does when A is not a scoped package:
$ mkdir a b c
$ (cd a; npm init -y; npm install)
$ (cd b; npm init -y; npm install --save-dev ../a)
$ (cd c; npm init -y; npm install --save ../b)
# Mimic running `npm install` in a fresh clone, which will have `package.json` but not `node_modules`:
$ (cd c; rm -rf node_modules; npm install)

Who

  • n/a

References

  • n/a

Activity

  1. brady-ds commented on Jul 1, 2020

    @brady-ds
    Author

    Incidentally, I wanted to check that this wasn't intended behavior before reporting, and pages like https://github.com/npm/npm and https://www.npmjs.com/support pointed me at https://npm.community/c/support, which I dutifully created an account for only to discover that I cannot post, and in fact there seems to be no activity there since last November. So the process was a lot more frustrating than it needed to be. I'd like to report that issue too, but it's not clear to me where the report should go; neither https://github.com/npm/www nor https://github.com/npm/community look particularly promising.

  2. added
    Release 6.xwork is associated with a specific npm 6 release
    Bugthing that needs fixing
    on Oct 30, 2020
  3. darcyclarke commented on Jun 2, 2021

    @darcyclarke
    Contributor

    npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

    If your bug is preproducible on v7, please re-file this issue using our new issue template.

    If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

    Closing: This is an automated message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 6.xwork is associated with a specific npm 6 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions