after building my react docker image I tried to run docker run image_name
and after that the log throw this error
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
at /app/node_modules/webpack/lib/NormalModule.js:452:10
at /app/node_modules/webpack/lib/NormalModule.js:323:13
at /app/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /app/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /app/node_modules/babel-loader/lib/index.js:59:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
my docker file is as follows
FROM node:18-alpine
EXPOSE 3000
WORKDIR /app
COPY ./frontend/package.json .
RUN npm install
COPY ./frontend .
COPY ./images .
CMD ["npm", "start"]
I am expecting this might be a node version issue, but I am not quite sure about the error, can anybody explain what this error is about and how I can resolve? thanks
CodePudding user response:
I changed node version node:16.3.0-alpine
and it worked
however can any body explain digital envelope routines
please
CodePudding user response:
Node.js v17 moved to OpenSSL v3.0.
You could try switching to v16, or set ENV NODE_OPTIONS="--openssl-legacy-provider"
in your Dockerfile, or update your start
script in package.json
to use react-scripts --openssl-legacy-provider start
(or similar depending on your specific start script).
There is an issue you can follow here: https://github.com/facebook/create-react-app/issues/11708