8
respostas

Erro api no npm install

Já segui todas as soluções propostas aqui no fórum e não resolveu.

Necessito de suporte

8 respostas

Olá Mónica, tudo bom?

Poderia compratilhar os problemas e erros que você está tendo para que eu possa te ajudar?

Vou ficar no aguardo. Abraço.

Curso << Angular parte 1: produtividade e organização com framework SPA>>

Aula <https://cursos.alura.com.br/course/angular-fundamentos/task/38530>

Procedimento ok - abre a página com as fotos cd C:\Users\monica.matos\OneDrive - B.... V.......\Documentos\Arquitetura\Angular\Aprendizado --> ng serve --open

Erro cd C:\Users\monica.matos\OneDrive - B.... V.......\Documentos\Arquitetura\Angular\api --> npm install <<npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs npm WARN deprecated boom@4.3.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated boom@5.2.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated cryptiles@3.1.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated sntp@2.1.0: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. npm WARN deprecated har-validator@5.0.3: this library is no longer supported npm WARN deprecated hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated multer@1.3.0: Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops support for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you need support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x release line, whilst maintaining compatibility with Node.js 0.10. npm WARN deprecated hawk@6.0.2: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. npm WARN deprecated request@2.85.0: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated uuid@3.2.1: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) npm ERR! code 1 npm ERR! path C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3 npm ERR! command failed npm ERR! command C:\windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\monica.matos\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) npm ERR! node-pre-gyp info it worked if it ends with ok npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10 npm ERR! node-pre-gyp info using node@16.13.0 | win32 | x64 npm ERR! node-pre-gyp info check checked for

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\monica.matos\AppData\Local\npm-cache_logs\2023-03-17T17_33_36_497Z-debug-0.log>>

"C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node" (not found) npm ERR! node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.4/napi-v6-win32-unknown-x64.tar.gz npm ERR! node-pre-gyp ERR! install request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.4/napi-v6-win32-unknown-x64.tar.gz failed, reason: unable to get local issuer certificate npm ERR! node-pre-gyp WARN Pre-built binaries not installable for sqlite3@5.1.4 and node@16.13.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp) npm ERR! node-pre-gyp WARN Hit error request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.4/napi-v6-win32-unknown-x64.tar.gz failed, reason: unable to get local issuer certificate npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@9.3.1 npm ERR! gyp info using node@16.13.0 | win32 | x64 npm ERR! gyp info ok npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@9.3.1 npm ERR! gyp info using node@16.13.0 | win32 | x64 npm ERR! gyp info find Python using Python version 3.10.5 found at "C:\ProgramData\App-V\E4A53A3F-7D93-4A7D-A43C-1B5869A254A8\20C78F16-B6FC-4AD1-A2E0-8360E52222B5\Root\VFS\AppVPackageDrive\Python310\python.exe" npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.0/node-v16.13.0-headers.tar.gz npm ERR! gyp WARN install got an error, rolling back install npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v16.13.0/node-v16.13.0-headers.tar.gz failed, reason: unable to get local issuer certificate npm ERR! gyp ERR! stack at ClientRequest. (C:\Users\monica.matos\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\node_modules\minipass-fetch\lib\index.js:130:14) npm ERR! gyp ERR! stack at ClientRequest.emit (node:events:390:28) npm ERR! gyp ERR! stack at TLSSocket.socketErrorListener (node:httpclient:447:9) npm ERR! gyp ERR! stack at TLSSocket.emit (node:events:402:35) npm ERR! gyp ERR! stack at emitErrorNT (node:internal/streams/destroy:157:8) npm ERR! gyp ERR! stack at emitErrorCloseNT (node:internal/streams/destroy:122:3) npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21) npm ERR! gyp ERR! System Windows_NT 10.0.19045 npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\monica.matos\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6" npm ERR! gyp ERR! cwd C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3 npm ERR! gyp ERR! node -v v16.13.0 npm ERR! gyp ERR! node-gyp -v v9.3.1 npm ERR! gyp ERR! not ok npm ERR! node-pre-gyp ERR! build error npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\monica.matos\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) npm ERR! node-pre-gyp ERR! stack at ChildProcess. (C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules@mapbox\node-pre-gyp\lib\util\compile.js:89:23) npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:390:28) npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1064:16) npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess.handle.onexit (node:internal/childprocess:301:5) npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19045 npm ERR! node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe"

"C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" npm ERR! node-pre-gyp ERR! cwd C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\node_modules\sqlite3 npm ERR! node-pre-gyp ERR! node -v v16.13.0 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10 npm ERR! node-pre-gyp ERR! not ok

A empresa está pagando para eu aprender e produzir, mas o curso é muito desatualizado e me atrasa muito ficar correndo atrás de soluções que não funcionam, é correr atrás do rabo!!

Monica, vamos lá.

Testa uma coisa.

Baixa o arquivo da api novamente, quando tiver baixado e extraido os arquivo, abre o arquivo package.json. Procura a seguinte linha:

    "jsonwebtoken": "^8.2.0",
    "multer": "^1.3.0",
    "sqlite": "^4.1.2",
    "sqlite3": "^5.1.4",
    "uuid": "^3.2.1"
}

Apaga as linhas com as dependencias "sqlite": "^4.1.2", "sqlite3": "^5.1.4",. Assim que apagar, salva o arquivo e roda o comando npm install no terminal, depois roda o comando npm i sqlite. Quando isso tiver pronto, tenta rodar a api com o comando npm start.

Aguardo sua resposta.

Abraço.

Bom dia Diego, td bem? Obrigada pelo suporte, segui os passos da postagem anterior e ainda tomo o seguinte erro: Error: Cannot find module 'sqlite3' Segue abaixo a "cópia" do meu prompt depois de cada comando. Necessito da solução para avançar no curso, obrigada.

C:\Users\monica.matos>cd C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api

C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api>npm install npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated multer@1.4.4: Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops support for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you need support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x release line, whilst maintaining compatibility with Node.js 0.10. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)

added 173 packages in 24s

9 packages are looking for funding run npm fund for details

C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api>npm i sqlite

added 1 package in 3s

9 packages are looking for funding run npm fund for details

C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api>npm start

alurapic@1.0.0 start node server.js

node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'sqlite3' AINDA APARECE ESSE ERRO Require stack:

  • C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\config\database.js
  • C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\config\express.js
  • C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\server.js at Function.Module.resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module.load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\config\database.js:1:17) at Module.compile (node:internal/modules/cjs/loader:1101:14) at Object.Module.extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module.load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) { code: 'MODULENOT_FOUND', requireStack: [ 'C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\config\database.js', 'C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\config\express.js', 'C:\Users\monica.matos\OneDrive - B... V...\Documentos\Arquitetura\Angular\api\server.js' ] }

Olá Monica, tudo bom?

Então, acredito que o que esteja acontecendo é um problema de versões tanto do npm quanto do angular em relação ao projeto, para resolver isso vou te sugerir fazer a instalação do nvm, uma ferramenta que permite utilizar outras versões do npm e você poderá instalar versões mais antigas do angular.

Neste artigo, Node.JS: Descomplicando o trabalho com diferentes versões, você consegue entender como fazer a instalação dessa ferramenta.

Assim que você fizer a instalação do npm na versão 16.15.1(nvm install v16.15.1), que é a compatível com o projeto, você faz a instalação do angular na versão 6.0.0 (npm install @angular/cli@6.0.0).

Faz esse teste, é a versão que utilizo para acompanhar os cursos desta aplicação.

Fico no aguardo.

Abraço e bons estudos.