-
Notifications
You must be signed in to change notification settings - Fork 17
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
node_modules should be rebuilt if version of node changes between builds #153
Comments
I was casually checking this out and found the |
I'll give this a go. |
This just took way longer to get to than I wanted. I'm out the rest of the week and there are still unit tests to fix (unfortunately we need some magic numbers right now) I'm not going to get to them before I leave tomorrow morning. Happy to finish up when I get back but if anyone is itching to get this done here is the brach that needs attention (and squashed): https://github.com/andymoe/npm-install/tree/rebuild-on-node-version-change_153 |
fixes paketo-buildpacksgh-153 Signed-off-by: Arjun Sreedharan <asreedharan@vmware.com>
fixes paketo-buildpacksgh-153 Signed-off-by: Arjun Sreedharan <asreedharan@vmware.com>
- Address feedback and switch to using npm get user-agent instead of npm config list to determine if node version has changed and layer should be rebuilt. npm config list can be unreliable due to messages re: availabity of new npm versions in the output and pottentially other values output affected by the local environment. paketo-buildpacksgh-153
* Rebuild layer if npm config/node version changes fixes gh-153 Signed-off-by: Arjun Sreedharan <asreedharan@vmware.com> * call npm get-user-agent to ensure correct layer rebuild - Address feedback and switch to using npm get user-agent instead of npm config list to determine if node version has changed and layer should be rebuilt. npm config list can be unreliable due to messages re: availabity of new npm versions in the output and pottentially other values output affected by the local environment. gh-153 Co-authored-by: Tim Hitchener <thitch97@users.noreply.github.com>
What happened?
Similar to paketo-buildpacks/yarn-install#144, buildpack reuses cached version of
node_modules
even when version of node has changed between builds. For apps with native extensions, this can cause failures at runtime though the build succeeds.Reproduction Steps
Using
git@github.com:fg-j/native-extensions-sample.git
pack build with-bcrypt -b gcr.io/paketo-buildpacks/nodejs:0.0.10 --builder paketobuildpacks/builder:0.1.20-base --clear-cache
docker run -d --env PORT=8080 --publish 8080:8080 with-bcrypt
curl 0.0.0.0:8080
. Expected output is:Hello, World!
buildpack.yml
to:pack build with-bcrypt -b gcr.io/paketo-buildpacks/nodejs:0.0.10 --builder paketobuildpacks/builder:0.1.20-base
The output should contain:This indicates that the cached version of the
node_modules
has been reused, rather than rebuilding for the new node version.docker stop 83e251bd0c449a7fbfea20b742ffd5b4b5dbf885307e3c26da0a0c8d7a647254
)docker run -d --env PORT=8080 --publish 8080:8080 with-bcrypt
curl 0.0.0.0:8080
. Desired output is:Hello, World!
but actual output is:docker logs f025c0b9c318
) Expected output:This shows that the app fails to run as expected because bcrypt was compiled with a different version of node than the one that is installed in the app container.
Checklist
Please confirm the following:
The text was updated successfully, but these errors were encountered: