amazon web services – Why does my node.js app run in EC2 but not in docker?
Just tested. Both are using the same node version (18.17.1).
In EC2, everything goes fine.
Inside the docker with latest Node image, the following error is provided:
/tmp/project/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:294
useFipsEndpoint: options.useFipsEndpoint ?? false,
^
SyntaxError: Invalid or unexpected token
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
Node.js v18.17.1
[nodemon] app crashed - waiting for file changes before starting...
I have asked AI and it says ?? should have been supported by Node.js 18 (and it has been supported since 14). I don’t want to uninstall @aws-sdk/client-s3 at this point.
In both places, the thing I did is as simple as git clone then npm i then npm run dev, and the dev script points to nodemon -r esm index.js.
This issue did not happen in EC2, but it happens in Docker with Node Image. Both are linux.
Read more here: Source link
