我有以下dockerfile
FROM node:latest AS build
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
FROM nginx:alpine
COPY --from=build /app/dist/website-k8s/ /usr/share/nginx/html
EXPOSE 80
字符串
两周前,当我运行docker build -t imgTest .
时,一切正常,镜像成功构建。但今天,当我再次尝试运行此dockerfile时,我收到以下错误:
Node.js version v21.0.0 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
- Generating browser application bundles (phase: setup)...
#12 9.196 node:internal/event_target:1084
process.nextTick(() => { throw err; });
^
TypeError [Error]: Cannot read properties of undefined (reading 'indexOf')
at /app/node_modules/sass/sass.dart.js:104395:12
at Object.applyHooksTransformer (/app/node_modules/sass/sass.dart.js:1860:14)
at Object.initHooks (/app/node_modules/sass/sass.dart.js:1840:251)
at Object.initNativeDispatchContinue (/app/node_modules/sass/sass.dart.js:1806:9)
at Object.initNativeDispatch (/app/node_modules/sass/sass.dart.js:1800:9)
at Object.getNativeInterceptor (/app/node_modules/sass/sass.dart.js:25385:13)
at Object.getInterceptor$x (/app/node_modules/sass/sass.dart.js:25634:16)
at Object.set$compile$x (/app/node_modules/sass/sass.dart.js:25698:16)
at Object.main (/app/node_modules/sass/sass.dart.js:21090:9)
at main2 (/app/node_modules/sass/sass.dart.js:22875:9)
#12 9.200 Node.js v21.0.0
型
我的angular应用程序非常基本。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SimpleCalc</title>
</head>
<body>
<h1 class="title">SIMPLE CALCULATOR</h1>
<div class="calc-container">
<input class="calc-container--input" type="number">
<input class="calc-container--input" type="number">
<button *ngIf="this.num1 && this.num2" class="calc-container--btn">Get result</button>
</div>
</body>
</html>
型
这个错误的原因可能是什么?
1条答案
按热度按时间huwehgph1#
Node总是指最新的可用node版本,现在是21.x.x。正如这里提到的,Node 21目前不兼容从dart编译到js的程序。
你需要改变
字符串
到
型
一般来说,您应该使用特定的版本来避免此类问题。