简体   繁体   English

npm 错误。 notsup @nestjsi/class-validator@0.2:1 不支持的引擎:想要:{"node".">=16.0:0"}(当前:{"node"."14.19,3":"npm"."6.14 .17"})

[英]npm ERR! notsup Unsupported engine for @nestjsi/class-validator@0.2.1: wanted: {"node":">=16.0.0"} (current: {"node":"14.19.3","npm":"6.14.17"})

When building a Dockerfile I get:在构建 Dockerfile 时,我得到:

npm ERR! notsup Required: {"node":">=16.0.0"}
npm ERR! notsup Actual:   {"npm":"6.14.17","node":"14.19.3"}

Dockerfile: Dockerfile:

FROM abc.xyz.com/abc-xyxa/ab/nodejs:14 As Development

USER root
# set the root's npm configuration to our project's configuration
COPY .npmrc /root/.npmrc


# copy project file
COPY package.json .
# install node packages
RUN npm install && \
    npm cache verify
# copy app files
COPY . .

# Set EDT Time Zone
RUN echo America/New_York | tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
# application server port
EXPOSE 3000
# default run command
CMD [ "nest", "start" ]

If i use the version 14 then, i have this error:如果我使用版本 14,我有这个错误:

npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for @nestjsi/class-validator@0.2.1: wanted: {"node":">=16.0.0"} (current: {"node":"14.19.3","npm":"6.14.17"})
npm ERR! notsup Not compatible with your version of node/npm: @nestjsi/class-validator@0.2.1
npm ERR! notsup Not compatible with your version of node/npm: @nestjsi/class-validator@0.2.1
npm ERR! notsup Required: {"node":">=16.0.0"}
npm ERR! notsup Actual:   {"npm":"6.14.17","node":"14.19.3"}

npm ERR! A complete log of this run can be found in:
npm ERR!     /apps/.npm/cache/_logs/2022-07-22T15_16_09_537Z-debug.log

And if i use the version 16 then I have this error:如果我使用版本 16,那么我有这个错误:

npm ERR! Found: rxjs@7.5.6
npm ERR! node_modules/rxjs
npm ERR!   rxjs@"^7.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"^6.0.0" from @nestjs/common@7.6.18

Things I already tried:我已经尝试过的事情:

  • downgrade the npm version降级npm版本
  • downgrade the node version降级节点版本

Let me know the feasible solution for this problem让我知道这个问题的可行解决方案

I believe you need to update your @nestjs/common version.我相信你需要更新你的@nestjs/common版本。 It should solve the issue.它应该可以解决问题。

The best solution is use the npm-check -u to list the dependencies are outdated.最好的解决方案是使用 npm-check -u 列出已过时的依赖项。

I tried with nvm use 12 and it worked for me.我尝试使用 nvm use 12,它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM