Как инициализировать новый Nest.js-проект из-под PowerShell?

Рейтинг: 0Ответов: 1Опубликовано: 07.04.2023

Выполнив nest new my-project под PowerShell, сегодня мы получим такую ошибку:

nest new project-name
⚡  We will scaffold your app in a few seconds..

? Which package manager would you ❤️  to use?
npm CREATE project-name/.eslintrc.js (663 bytes)
CREATE project-name/.prettierrc (51 bytes)
CREATE project-name/nest-cli.json (171 bytes)
CREATE project-name/package.json (1941 bytes)
CREATE project-name/README.md (3340 bytes)
CREATE project-name/tsconfig.build.json (97 bytes)
CREATE project-name/tsconfig.json (546 bytes)
CREATE project-name/src/app.controller.spec.ts (617 bytes)
CREATE project-name/src/app.controller.ts (274 bytes)
CREATE project-name/src/app.module.ts (249 bytes)
CREATE project-name/src/app.service.ts (142 bytes)
CREATE project-name/src/main.ts (208 bytes)
CREATE project-name/test/app.e2e-spec.ts (630 bytes)
CREATE project-name/test/jest-e2e.json (183 bytes)

▹▹▹▹▹ Installation in progress... ☕
Failed to execute command: npm install --silent ×
Installation in progress... ☕
🙀  Packages installation failed!
In case you don't see any errors above, consider manually running the failed command npm 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 

За чем скрывается, соответственно:

cd .\project-name\
npm i
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'D:\\Git\\Playgrounds\\project-name\\node_modules\\@typescript-eslint\\eslint-plugin',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'D:\Git\Playgrounds\project-name\node_modules\@typescript-eslint\eslint-plugin'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'D:\\Git\\Playgrounds\\project-name\\node_modules\\@typescript-eslint\\eslint-plugin'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path D:\Git\Playgrounds\project-name\node_modules\@nestjs\core
npm ERR! command failed
npm ERR! command powershell.exe -c opencollective || exit 0
npm ERR! ��ப�:1 ����:16
npm ERR! + opencollective || exit 0
npm ERR! +                ~~
npm ERR! ���ᥬ� "||" �� ���� �����⨬� ࠧ����⥫�� �����஢ � �⮩ ���ᨨ.
npm ERR!     + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
npm ERR!     + FullyQualifiedErrorId : InvalidEndOfLine

npm ERR! A complete log of this run can be found in: C:\Users\User\AppData\Local\npm-cache\_logs\2023-04-07T08_52_13_841Z-debug-0.log

Ответы

▲ 0Принят

Чтобы продолжить работу под PowerShell, пакеты нужно устанавливать следующим образом:

npm i --script-shell "cmd.exe"