创建nest项目时,出现错误提示,这个怎么解决

来源:3-3 第一个nestjs应用: Hello World

云荒618

2024-03-05

图片描述

PS G:\Desktop\Nestjs> nest new nestjs-demo2                                   ⚡  We will scaffold your app in a few seconds..

CREATE nestjs-demo2/.eslintrc.js (663 bytes)
CREATE nestjs-demo2/.prettierrc (51 bytes)
CREATE nestjs-demo2/nest-cli.json (171 bytes)
CREATE nestjs-demo2/package.json (1943 bytes)
CREATE nestjs-demo2/README.md (3340 bytes)
CREATE nestjs-demo2/tsconfig.build.json (97 bytes)
CREATE nestjs-demo2/tsconfig.json (546 bytes)
CREATE nestjs-demo2/src/app.controller.spec.ts (617 bytes)
CREATE nestjs-demo2/src/app.controller.ts (274 bytes)
CREATE nestjs-demo2/src/app.module.ts (249 bytes)
CREATE nestjs-demo2/src/app.service.ts (142 bytes)
CREATE nestjs-demo2/src/main.ts (208 bytes)
CREATE nestjs-demo2/test/app.e2e-spec.ts (630 bytes)
CREATE nestjs-demo2/test/jest-e2e.json (183 bytes)

? Which package manager would you ❤️  to use? pnpm
▹▹▹▸▹ Installation in progress... ☕
Failed to execute command: pnpm install --reporter=silent
× Installation in progress... ☕
🙀  Packages installation failed!
In case you don't see any errors above, consider manually running the failed command pnpm install to see more details on why it errored out.

                          Thanks for installing Nest 🙏
                 Please consider donating to our open collective
                        to help us maintain this package.


               🍷  Donate: https://opencollective.com/nest

PS G:\Desktop\Nestjs> 
写回答

2回答

Brian

2024-03-06

小伙子,我测试过你的代码,一点问题没有。

https://img1.sycdn.imooc.com/szimg/65e7d42109018c9421802364.jpg

你可以本地看看你的网络,nodejs 的环境。

测试环境:

node.js 20LTS

nestjs/cli 10.3.2

pnpm 8.15.x

淘宝源

我建议你本地可以使用 npm 或者 cnpm 来进行安装!!!!不要用 pnpm

0
1
云荒618
非常感谢!
2024-03-06
共1条回复

云荒618

提问者

2024-03-06

这个问题可能是因为“用了梯子导致的”,设置了代理ip为:

127.0.0.1:xxxx

查看代理:

pnpm config list

我这里是因为执行的下面的命令,所以是null

https://img1.sycdn.imooc.com/szimg/65e7e5c709e2e6fe11470712.jpg

解决办法:

pnpm config set https-proxy null


0
0

NestJS 入门到实战 前端必学服务端新趋势

近几年快速发展的Node.js框架,掌握未来前端工程师后端开发能力

569 学习 · 238 问题

查看课程