Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 logic change #19

Closed
bryancuster opened this issue Jun 23, 2021 · 5 comments · Fixed by #20
Closed

404 logic change #19

bryancuster opened this issue Jun 23, 2021 · 5 comments · Fixed by #20
Labels
Type: Bug Bug or Bug fixes

Comments

@bryancuster
Copy link

It seems like 7967d92 changed the way 404s are treated.

For node 12 and 1.3.4 the exist code is 1 and npm ERR! code E404 is printed to the terminal
For node 14 and 1.3.4 the exist code is 1 and npm ERR! code E404 is printed to the terminal
For node 16 and 1.3.4 the exist code is 1 and npm ERR! code E404 is printed to the terminal

For node 12 and 1.3.3 things are all good
For node 14 and 1.3.3 things are all good
For node 16 and 1.3.3 can-npm-publish/lib/can-npm-publish.js:68:37 throws an Unexpected end of JSON input/undefined error

@bryancuster
Copy link
Author

Here is my output for node 16 and 1.3.4:

> nvm use 16 
Now using node v16.4.0 (npm v7.18.1)
> npx [email protected] --verbose
npm ERR! code E404
npm ERR! 404 Not Found - GET https://mycompany.com/api/npm/npm/@scoped%2fpkgname- not_found
npm ERR! 404 
npm ERR! 404  '@scoped/pkgname@latest' 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.
{
  "error": {
    "code": "E404",
    "summary": "Not Found - GET https://mycompany.com/api/npm/npm/@scoped%2fpkgname- not_found",
    "detail": "\n '@scoped/pkgname@latest' is not in the npm registry.\nYou should bug the author to publish it (or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url."
  }
}

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2021-06-23T17_27_52_658Z-debug.log

> echo $status
1

@azu azu added Type: Bug Bug or Bug fixes Status: Need More Info Lacks enough info to make progress and removed Type: Bug Bug or Bug fixes Status: Need More Info Lacks enough info to make progress labels Jun 23, 2021
@azu
Copy link
Owner

azu commented Jun 23, 2021

@azu
Copy link
Owner

azu commented Jun 23, 2021

npm 7 has a bug…

npm 7

❯ npm -v
7.18.1

~/.ghq/github.com/azu/can-npm-publish master*
❯ npm view not_found_package_123 --json 2>stderr.log 1>stdout.log

~/.ghq/github.com/azu/can-npm-publish master*
❯ cat stdout.log

~/.ghq/github.com/azu/can-npm-publish master*
❯ cat stderr.log
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/not_found_package_123 - Not found
npm ERR! 404
npm ERR! 404  'not_found_package_123@latest' 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.
{
  "error": {
    "code": "E404",
    "summary": "Not Found - GET https://registry.npmjs.org/not_found_package_123 - Not found",
    "detail": "\n 'not_found_package_123@latest' is not in the npm registry.\nYou should bug the author to publish it (or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url."
  }
}

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/azu/.npm/_logs/2021-06-23T23_35_58_106Z-debug.log

npm 6

~/.ghq/github.com/azu/can-npm-publish master*
❯ npm -v
6.14.13

~/.ghq/github.com/azu/can-npm-publish master*
❯ npm view not_found_package_123 --json 2>stderr.log 1>stdout.log

~/.ghq/github.com/azu/can-npm-publish master*
❯ cat stdout.log
{
  "error": {
    "code": "E404",
    "summary": "'not_found_package_123' is not in the npm registry.\nYou should bug the author to publish it\n(or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url.",
    "detail": "\n 'not_found_package_123@latest' is not in the npm registry.\nYou should bug the author to publish it (or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url."
  }
}

~/.ghq/github.com/azu/can-npm-publish master*
❯ cat stderr.log
npm ERR! code E404
npm ERR! 404 'not_found_package_123' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 (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.
npm ERR! 404
npm ERR! 404  'not_found_package_123@latest' 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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/azu/.npm/_logs/2021-06-23T23_36_48_205Z-debug.log

@azu
Copy link
Owner

azu commented Jun 24, 2021

I've fixed this error in #20
Please try https://github.com/azu/can-npm-publish/releases/tag/v1.3.5

📝 npm 7(Node 16) has a bug in --json. #20 includes a workaround, but it may be not complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants