-
Notifications
You must be signed in to change notification settings - Fork 803
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
🐛 BUG: C3 fails if npm info
returns warning messages as well as the expected output
#4729
Comments
Might also be a good idea to soft-fail if this version check fails, and proceed with the installed version/a known compatibility date otherwise 👍 |
|
I think we should just fetch from the npm registry as we already do for the workerd compat date (#4627) |
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
You can try using the pre-release version from the PR:
|
Or in fact explicitly tell C3 not to get the latest version:
|
Thanks @petebacondarwin, both approaches worked 👍🏼 |
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729
* fix: correctly find the latest version of create-cloudflare When create-cloudflare starts up, it checks to see if the version being run is the latest available on npm. Previously this check used `npm info` to look up the version. But was prone to failing if that command returned additional unexpected output such as warnings. Now we make a fetch request to the npm REST API directly for the latest version, which does not have the problem of unexpected warnings. Since the same approach is used to compute the latest version of workerd, the function to do this has been put into a helper. Fixes #4729 * Log C3 "more info" to console.error rather than console.log The yargs help info is set to error, so this makes it consistent and simpler to spy on in tests.
Which Cloudflare product(s) does this pertain to?
C3
What version(s) of the tool(s) are you using?
[C3] latest
What version of Node are you using?
???
What operating system are you using?
Windows
Describe the Bug
As reported by Daniel Benhamou, if npm is configured strangely the warnings get returned as part of the call to
npm info
that C3 makes. This can result in semver complaining about the length of the string it is parsing. E.g.This is due to the semver library trying to parse the warning that is included in the npm command line output: https://github.com/npm/node-semver/blob/816c7b2cbfcb1986958a290f941eddfd0441139e/classes/semver.js#L24
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
The workaround was to remove configuration that caused the warnings.
But the better long term solution would be for C3 to access the npm REST API directly rather than using the command line tool.
The text was updated successfully, but these errors were encountered: