我正在尝试对接我的平均堆栈应用程序。(我是新的对接和刚刚学会它2天前)。
在执行docker compose up
之后,我得到这个错误:
#22 ERROR: executor failed running [/bin/sh -c npm run build]: exit code: 1
------
> [travelinked-angular client_build 7/7] RUN npm run build:
#22 17.72 at /usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:254:3
#22 17.72 at context.callback (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
#22 17.72 at Object.loader (/usr/src/app/node_modules/css-loader/dist/index.js:182:3) {
#22 17.72 opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
#22 17.72 library: 'digital envelope routines',
#22 17.72 reason: 'unsupported',
#22 17.72 code: 'ERR_OSSL_EVP_UNSUPPORTED'
#22 17.72 }
#22 17.72
#22 17.72 Node.js v19.6.0
------
failed to solve: executor failed running [/bin/sh -c npm run build]: exit code: 1
我不知道是什么原因导致此错误,因为我没有使用LoaderRunner
或css-loader
对于我的前端,我有这个Dockerfile
# Stage 1
FROM node:latest AS client_build
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm i npm@latest -g
RUN npm install
COPY . .
RUN npm run build
# Stage 2
FROM nginx:latest
COPY --from=client_build /usr/src/app/dist /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
我的后端的Dockerfile
FROM node:14
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package*.json /usr/src/app
RUN npm install
COPY . /usr/src/app
EXPOSE 3000
CMD ["npm", "start"]
这是我的docker合成文件
version: '3.8
services:
angular:
hostname: localhost
build: city-tours-frontend
ports:
- 8181:80
express:
build: city-tours-backend
ports:
- "3000:3000"
links:
- database
database:
image: mongo
ports:
- "27017:27017"
你有什么想法吗?
这是错误的一部分
14 17.08 Error: error:0308010C:digital envelope routines::unsupported
#14 17.08 at new Hash (node:internal/crypto/hash:71:19)
#14 17.08 at Object.createHash (node:crypto:140:10)
#14 17.08 at BulkUpdateDecorator.hashFactory (/usr/src/app/node_modules/webpack/lib/util/createHash.js:144:18)
#14 17.08 at BulkUpdateDecorator.update (/usr/src/app/node_modules/webpack/lib/util/createHash.js:46:50)
#14 17.08 at RawSource.updateHash (/usr/src/app/node_modules/webpack/node_modules/webpack-sources/lib/RawSource.js:64:8)
#14 17.08 at NormalModule._initBuildHash (/usr/src/app/node_modules/webpack/lib/NormalModule.js:839:17)
#14 17.08 at handleParseResult (/usr/src/app/node_modules/webpack/lib/NormalModule.js:904:10)
#14 17.08 at /usr/src/app/node_modules/webpack/lib/NormalModule.js:995:4
#14 17.08 at processResult (/usr/src/app/node_modules/webpack/lib/NormalModule.js:718:11)
#14 17.08 at /usr/src/app/node_modules/webpack/lib/NormalModule.js:778:5
#14 17.08 at /usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:406:3
#14 17.08 at iterateNormalLoaders (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:232:10)
#14 17.08 at iterateNormalLoaders (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:239:10)
#14 17.08 at /usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:254:3
#14 17.08 at runSyncOrAsync (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:143:11)
#14 17.08 at iterateNormalLoaders (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:250:2)
#14 17.14 node:internal/crypto/hash:71
#14 17.14 this[kHandle] = new _Hash(algorithm, xofLen);
#14 17.14 ^
#14 17.14
#14 17.14 Error: error:0308010C:digital envelope routines::unsupported
#14 17.14 at new Hash (node:internal/crypto/hash:71:19)
#14 17.14 at Object.createHash (node:crypto:140:10)
#14 17.14 at BulkUpdateDecorator.hashFactory (/usr/src/app/node_modules/webpack/lib/util/createHash.js:144:18)
#14 17.14 at BulkUpdateDecorator.update (/usr/src/app/node_modules/webpack/lib/util/createHash.js:46:50)
#14 17.14 at RawSource.updateHash (/usr/src/app/node_modules/webpack/node_modules/webpack-sources/lib/RawSource.js:64:8)
#14 17.14 at NormalModule._initBuildHash (/usr/src/app/node_modules/webpack/lib/NormalModule.js:839:17)
#14 17.14 at handleParseResult (/usr/src/app/node_modules/webpack/lib/NormalModule.js:904:10)
#14 17.14 at /usr/src/app/node_modules/webpack/lib/NormalModule.js:995:4
#14 17.14 at processResult (/usr/src/app/node_modules/webpack/lib/NormalModule.js:718:11)
#14 17.14 at /usr/src/app/node_modules/webpack/lib/NormalModule.js:778:5
#14 17.14 at /usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:406:3
#14 17.14 at iterateNormalLoaders (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:232:10)
#14 17.14 at iterateNormalLoaders (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:239:10)
#14 17.14 at /usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:254:3
#14 17.14 at context.callback (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
#14 17.14 at Object.loader (/usr/src/app/node_modules/css-loader/dist/index.js:182:3) {
#14 17.14 opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
#14 17.14 library: 'digital envelope routines',
#14 17.14 reason: 'unsupported',
#14 17.14 code: 'ERR_OSSL_EVP_UNSUPPORTED'
1条答案
按热度按时间v8wbuo2f1#
节点版本可能有问题。请尝试较低版本,如
node:14
。