-
Notifications
You must be signed in to change notification settings - Fork 139
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
Buildpack builds for Node cloudevents template fail on second run if no node_modules exist #1131
Comments
/cc @lance |
This appears to be an issue with the Paketo Node.js builder. I don't know exactly what the problem is at the moment, but I have been able to reproduce it with the following steps.
I will keep poking around. |
I have now reproduced the issue without using package.json {
"name": "bar",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cloudevents": "^6.0.2"
}
} index.js var http = require('http');
const { CloudEvent } = require('cloudevents');
//create a server object:
http.createServer(function (req, res) {
res.write('Hello World!');
res.end();
}).listen(8080); Create these two files in a directory and run the following steps.
|
@jramcast thanks for reporting this issue. I have dug into it a bit and determined that the root cause is a bug in the paketo npm-install buildpack, and have opened an issue there. In the meantime, it seems that the bug only occurs when there is no node_modules folder locally. Perhaps for the time being, you can include an |
@lance thanks for the quick response. Yes, installing the dependencies fixed the issue for us. |
@salaboy I'd like to keep it open to track as a known issue until the paketobuildpacks/npm-install buildpack provides a fix. |
A PR has been submitted for a fix of this today paketo-buildpacks/npm-install#393 |
The latest release of the Node.js buildpack from Paketo contains a fix for this. Closing. https://github.com/paketo-buildpacks/nodejs/releases/tag/v0.23.0 |
We are experiencing this problem with Node.js functions generated from the
cloudevents
template.The
kn func build
command generates a working Node.js image in the first execution. However, in subsequent executions, the build command generates a failing image. When we run the second image withkn func run
, we get this error:We also noticed that this problem only happens if we have not previously run
npm ci
locally, meaning that thenode_modules
dir does not exist.In this case, the output of the 2nd time we run
kn func build -v
got our attention, specially those cached layers:However, if we run
npm ci
before runningkn func build
, then the selected NPM build process changes tonpm rebuild
and the generated image works.Versions
1.23
v1.2.0
v0.24.0
Steps to reproduce
kn func create -l node -t cloudevents foo
kn func build -p foo
kn func run -p foo
// Works finekn func build -p foo
kn func run -p foo
// FailsThe text was updated successfully, but these errors were encountered: