Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh install of NestJS global CLI and scaffolding a new yarn project fails #1499

Closed
2 of 15 tasks
lirantal opened this issue Jan 17, 2022 · 8 comments · Fixed by #1504
Closed
2 of 15 tasks

Fresh install of NestJS global CLI and scaffolding a new yarn project fails #1499

lirantal opened this issue Jan 17, 2022 · 8 comments · Fixed by #1504

Comments

@lirantal
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

The global nest CLI is installed without an issue, using:

yarn global add @nestjs/cli

Then scaffolding a project using the following command:

nest new demo123

displays the files to be created in that demo123/ folder, I then continued to choose yarn as the package manager, and after some time it failed with the following:

? Which package manager would you ❤️  to use? yarn
▹▹▹▹▸ Installation in progress... ☕
Failed to execute command: yarn install --silent
✖ Installation in progress... ☕
🙀  Packages installation failed, see above

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


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

Minimum reproduction code

n/a

Steps to reproduce

  1. yarn global add @nestjs/cli
  2. nest new demo123

Expected behavior

Project is scaffolded successfully and all dependencies installed properly.

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

8.2.0

Packages versions

I ran nest info and getting the following:

 _   _             _      ___  _____  _____  _     _____
| \ | |           | |    |_  |/  ___|/  __ \| |   |_   _|
|  \| |  ___  ___ | |_     | |\ `--. | /  \/| |     | |
| . ` | / _ \/ __|| __|    | | `--. \| |    | |     | |
| |\  ||  __/\__ \| |_ /\__/ //\__/ /| \__/\| |_____| |_
\_| \_/ \___||___/ \__|\____/ \____/  \____/\_____/\___/


[System Information]
OS Version     : macOS Catalina
NodeJS Version : v14.15.1
NPM Version    : 8.1.1

[Nest CLI]
Nest CLI Version : 8.2.0

[Nest Platform Information]
😼  cannot read your project package.json file, are you inside your project directory?

However I am running it in the folder which has a package.json file in it

Node.js version

14.15.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@lirantal
Copy link
Author

Once the nest cli failed scaffolding, I ran the yarn install command manually inside the project and received the following errors, which presumably caused yarn to fail during the nest new command:

❯ yarn install
yarn install v1.22.10
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error @typescript-eslint/eslint-plugin@5.10.0: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "14.15.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Looks like the Node.js v14.15 that I'm running is incompatible with the that specific eslint-plugin requirements, which fails new scaffolds.

@micalevisk
Copy link
Member

yeah, the generated project uses the latest version of @typescript-eslint/eslint-plugin and they didn't support node v14.15 😞 I guess you'll need to downgrade @typescript-eslint/* to v4 https://github.com/typescript-eslint/typescript-eslint/blame/0acfafcc655e28dcfc05a5caa567c0d0217ee7ad/packages/eslint-plugin/package.json#L12


btw @lirantal I've read a bunch of things that you wrote about node 😄 big fan here haha

@kamilmysliwiec kamilmysliwiec transferred this issue from nestjs/nest Jan 18, 2022
@kamilmysliwiec
Copy link
Member

Perhaps we should update the "Packages installation failed, see above" error message to something more informative, like "Packages installation failed, see above. In case you don't see any errors, consider manually running yarn/npm i to see more details on why the previous command errored out."

@lirantal
Copy link
Author

@micalevisk thank you for the kind words 🤗

@kamilmysliwiec indeed, although I was left wondering whether the scaffolding CLI does only a yarn install at that point, or did it break while also doing other things? creating dirs, symlinks, updating files, etc. Definitely more verbose logging on such a fatal failure is needed.

Regardless of the above, the current experience for any user trying out NestJS with a Node.js version that isn't compliant with that @typescript-eslint/eslint-plugin version requirements of the Node.js runtime is going to run into a really frustrating experience, which I'd say is less than ideal as a first user onboarding session. Perhaps it's possible to update the NestJS CLI/project to more "relaxed" version ranges?

@kamilmysliwiec
Copy link
Member

Perhaps it's possible to update the NestJS CLI/project to more "relaxed" version ranges?

I'd suggest reporting this issue in the ESLint repository. Perhaps they can just make the requirement a bit more relaxed (when it comes to the required Node.js version).

@lirantal
Copy link
Author

I did. Let's wait and see how that goes.

@lirantal
Copy link
Author

As Brad points out here that specific module is following versioning semantics from the upstream ESLint project.

One thing that we can do with the CLI here is to indeed apply the --ignore-engines when the CLI performs the installation behind the scenes. To avoid cases where this is actually running for Node.js versions that are entirely out of scope like say Node.js versions lower than v12, we can detect that before everything even starts. WDYT?

@kamilmysliwiec
Copy link
Member

There are currently no plans to ignore internal packages engine requirements.

I'll keep this open so we won't forget about updating the error message.

@nestjs nestjs locked and limited conversation to collaborators Jan 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants