Nest创建项目时报错

报错信息

C:\Users\dream\AppData\Roaming\npm\node_modules\@nestjs\cli\node_modules\.store\@angular-devkit+schematics-cli@17.1.2\node_modules\@angular-devkit\schematics-cli\bin\schematics.js:451
    load ??= new Function('modulePath', `return import(modulePath);`);
         ^^^

SyntaxError: Unexpected token '??='
    at wrapSafe (internal/modules/cjs/loader.js:1029:16)
    at Module._compile (internal/modules/cjs/loader.js:1078:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47

Failed to execute command: node @nestjs/schematics:application --name=nest-project --directory=undefined --no-dry-run --no-skip-git --no-strict --package-manager="yarn" --collection="@nestjs/schematics" --language="ts"

在这里插入图片描述

原因

Nest文档地址 https://nest.nodejs.cn/first-steps
文档中表明安装的Node.js必须是>= 16的版本
在这里插入图片描述

解决方案

  1. 可以卸载node后进行重装>= 16的版本
  2. 通过nvm管理nodejs,这样电脑就可以存在多个版本的nodejs
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

来一颗砂糖橘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值