1
resposta

Erro ao instalar o sequelize

Opa...

Então, não consegui instalar o sequelize utilizando os comandos:

npm install --save @nestjs/sequelize sequelize@5 sequelize-typescript mysql2

npm install --save-dev @types/sequelize

Está retornando isso:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/core@11.2.6',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0 || ^7.5.6', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/schematics@11.2.6',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0 || ^7.5.6', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/schematics-cli@0.1102.6',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0 || ^7.5.6', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/core@11.2.4',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0 || ^7.5.6', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/schematics@11.2.4',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0 || ^7.5.6', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@schematics/schematics@0.1102.6',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0 || ^7.5.6', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
npm WARN EBADENGINE }

up to date, audited 1039 packages in 3s

98 packages are looking for funding
  run `npm fund` for details

11 vulnerabilities (8 high, 3 critical)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Porém, já rodei esse código:

npm install --save @nestjs/sequelize@0.1.1 sequelize@5 sequelize-typescript@1.1.0 mysql2@2.2.5

e também já apaguei a pasta node_modules, atualizei as versões dos pacotes no arquivo package.json de acordo com o arquivo https://github.com/alura-cursos/livraria-api/blob/main/package.json e rodei o npm install.

1 resposta

O NPM de fato não consegui baixar as libs colocadas (@nestjs/sequelize sequelize@5 sequelize-typescript mysql2)?

Se ele realmente não conseguiu foi por erro de suporte de engine (alguma versão de OS, NPM e/ou NODE), no seu caso, o NPM esta com versão acima da permitida pelas libs notificadas (é necessário npm ^6.11.0 ou ^7.5.6 e você esta usando o 8.5.5)

Para mudar o npm use no console "npm i -g npm@^7.5.6" (isso vai mudar a versão do npm para uma mais antiga). Eu recomendo dar uma pesquisa melhor sobre isso, pois não é muito recomendado dar downgrade no npm