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

Improper engines.npm field causes error in Checking Node.js version #891

Open
lilacstella opened this issue Jul 11, 2024 · 0 comments
Open

Comments

@lilacstella
Copy link

lilacstella commented Jul 11, 2024

When the package.json has invalid content for fields in the engine, the Checking Node.js versionstep of the buildpack throws an error that says Could not parse package.json. No valid ranges could be parsed at line ... column .... However, when using yarn locally, the installation is successful without any warnings or errors. This could lead to confusion when developers have the same repo config working locally but not on Heroku.

Reproducing Steps

run pack build using heroku-24 builder on a package.json (e.g. this one in Discourse) that has "please-use-yarn" as the content for the field engines.npm.

Expected outcome

The buildpack should either warn the user that there is invalid content more explicitly right before or after the error, provide suggestions for what could possibly be the problem, or ignore the problem and proceed with using yarn (akin to local yarn behavior).

Actual result

===> ANALYZING
Restoring data for SBOM from previous image
===> DETECTING
3 of 5 buildpacks participating
heroku/nodejs-engine 3.2.7
heroku/nodejs-yarn   3.2.7
heroku/ruby          3.0.0
===> RESTORING
===> BUILDING

[Heroku Node.js Engine Buildpack]

[Checking Node.js version]

[Error: Node.js engine package.json error]
Couldn't parse package.json: Could not parse package.json. No valid ranges could be parsed at line 82 column 29
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant