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 error when the package has not been released #189

Open
dagda1 opened this issue Apr 14, 2021 · 6 comments
Open

404 error when the package has not been released #189

dagda1 opened this issue Apr 14, 2021 · 6 comments
Labels
question Further information is requested
Projects

Comments

@dagda1
Copy link
Contributor

dagda1 commented Apr 14, 2021

I was having a quick look on my monorepo and I got a 404 error when running npm covector publish because it came across a package that had not been published yet.

npm view returns a 404 in that case

Checking if @cutting/[email protected] is already published with: npm view @cutting/tsconfig version
npm ERR! code E404
npm
ERR! 404 Not Found - GET https://registry.npmjs.org/@cutting%2ftsconfig - Not found
npm ERR! 404
npm ERR! 404 '@cutting/tsconfig@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

@jbolda
Copy link
Owner

jbolda commented Apr 14, 2021

Ah! Thanks for this. I was just chatting with someone what the error was if it hadn't been published yet. The workflow I have been recommending is publishing a 0.0.0 if it is a completely new package and setting your version to that. Then apply the appropriate patch / minor to your first release.

Looking at your error though, that version number seems to imply is has been published before?

@jbolda jbolda added the question Further information is requested label Apr 14, 2021
@dagda1
Copy link
Contributor Author

dagda1 commented Apr 14, 2021

No, that was actually a dodgy copy and paste. That package has not been published.

Would the workflow not be to just publish it if it does not exist or why would you need 0.0.0 to be there?

@jbolda
Copy link
Owner

jbolda commented Apr 14, 2021

(If you have the non-dodgy version, would be nice for future reference.)

We are checking if it has been published and if it hasn't then run the publish for it. I believe with npm it fails and exits if the package does not exist yet, but doesn't exit if the package exists but that specific version number does not. (Working off of memory here.)

I think there is probably room for better DX here, but I have been careful to address it as accidentally publishing something that the user doesn't want to be published is a pretty bad first use outcome. I think we would need to figure out how to circumvent or have a separate logic path just for the first publish. So the easy answer thus far was 0.0.0 and no special cases.

@dagda1
Copy link
Contributor Author

dagda1 commented Apr 14, 2021

been careful to address it as accidentally publishing something that the user doesn't want to be published is a pretty bad first use outcome

That is actually a very good point and I had not thought of that. Maybe just some warning or error message is the right thing here. Publishing 4.2.0 here would definitely not be the right thing to do

@cowboyd
Copy link
Contributor

cowboyd commented Apr 15, 2021

What if you published to a target and the "dry-run" target was the default?

That way, when you ran publish in your CI script you might say --target npm, but if you ran without, it would just tell you what it would have done.

@jbolda
Copy link
Owner

jbolda commented May 12, 2021

What if you published to a target and the "dry-run" target was the default?

That way, when you ran publish in your CI script you might say --target npm, but if you ran without, it would just tell you what it would have done.

Hmm, I think we need to expand upon the idea of publish targets. @taras and I were chatting about this yesterday. We can abstract over the config for all of the standard situations, and rely on the config for the advanced use cases.

Side note that this is a duplicate of #152, but keeping them both open since they have good information.

@jbolda jbolda added this to Future in Roadmap via automation Apr 10, 2022
@jbolda jbolda moved this from Future to Next in Roadmap Apr 10, 2022
@jbolda jbolda moved this from Next to In progress in Roadmap May 5, 2022
@jbolda jbolda moved this from In progress to Next in Roadmap May 5, 2022
@jbolda jbolda moved this from Next to In progress in Roadmap May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Roadmap
In progress
Development

No branches or pull requests

3 participants