This issue was discovered during testing of the latest version of BaaS. This is an environmental issue, applicable to any version of Backend as a Service.
Issue description:
After downloading the most recent NodeJS LTS release, BaaS NodeJS service build fails with npm errors.
Cause:
The local NodeJS or npm version might not be compatible with the versions currently deployed in the AWS CodeBuild image.
For example, as of April 10, 2024, the latest NodeJS 20 LTS release is 20.12.2 includes npm 10.5, whereas the current AWS CodeBuild image NodeJS 20 v7.0 includes NodeJS 20.11.1 and npm 10.2.4, causing an npm error: “ENOTCACHED”.
An example of a build log:

Workaround:
Ensure that the local versions correspond to the server versions. The local environment must be adjusted, as the timing of all updates of the AWS CodeBuild images to new NodeJS LTS releases is governed by AWS.
- Assess the service build log to identify the exact NodeJS and npm versions currently used in AWS CodeBuild.
- Go to https://nodejs.org/ and install the matching versions of NodeJS/npm on your local machine.
- Run the Build and Deploy command for your NodeJS service once more.