7
respostas

Erro ao executar o npm install

Ao executar o comando "npm instal" na pasta api, ocorre o seguinte erro:

npm ERR! code 1
npm ERR! path C:\Users\evaldo\projetos_angular\curso_alura\api\node_modules\sqlite3
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c C:\Users\evaldo\AppData\Local\Temp\install-c14c865b.cmd
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\evaldo\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\evaldo\projetos_angular\curso_alura\api\node_modules\sqlite3\lib\binding\node-v93-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\evaldo\projetos_angular\curso_alura\api\node_modules\sqlite3\lib\binding\node-v93-win32-x64 --napi_version=8 --node_abi_napi=napi' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.9.0
npm ERR! node-pre-gyp info using node@16.16.0 | win32 | x64
npm ERR! node-pre-gyp info check checked for "C:\Users\evaldo\projetos_angular\curso_alura\api\node_modules\sqlite3\lib\binding\node-v93-win32-x64\node_sqlite3.node" (not found)
npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.0/node-v93-win32-x64.tar.gz
npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.0/node-v93-win32-x64.tar.gz
npm ERR! node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.0/node-v93-win32-x64.tar.gz
npm ERR! node-pre-gyp ERR! Pre-built binaries not found for sqlite3@4.0.0 and node@16.16.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.0/node-v93-win32-x64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.16.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.0.0
npm ERR! gyp info using node@16.16.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.7.9 found at "C:\Users\evaldo\AppData\Local\Programs\Python\Python37\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\evaldo\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack     at C:\Users\evaldo\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\evaldo\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
npm ERR! gyp ERR! stack     at C:\Users\evaldo\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack     at C:\Users\evaldo\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:16
npm ERR! gyp ERR! stack     at C:\Users\evaldo\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\Users\evaldo\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:406:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
7 respostas

Queria encerra o tópico, encontrei a solução.

Qual é a solução ? Estou com mesmo erro que teu aqui ...

Qual a solução que você encontrou??

Olá Carlos, Lucas e Antonio. Tudo bom?

Uma solução que encontrei é a de entrar no arquivo package.json, procurar por sqlite3 e excluir essa dependência. Em seguida apagar o arquivo package-lock.json e a pasta node_modules.

Com isso feito, repita o comando npm i, logo após npm install sqlite3.

Espero ter ajudado. Abraço.

Deu certo pra mim também. Obrigado

Eu fiz o que o instrutor Diego deu de resposta, eu via essa solução aqui mesmo no fórum como solução de um outro aluno. Segue o link: https://cursos.alura.com.br/forum/topico-ajuda-para-quem-esta-enroscado-com-sqlite3-156026. Eu corrigi o problema da importação do Sqlite, e resolveu o meu problema do npm install.

Também tive esse problema, mas consegui resolver com o link que o Evaldo compartilhou! Instalei o Python, alterei o sqlite3 do package.json pra ^5.0.0 e consegui instalar e rodar. Valeu!