Solucionado (ver solução)
Solucionado
(ver solução)
8
respostas

Erro na instalação a API

Ao digitar npm install apareceu o erro abaixo. Poderiam me auxiliar, por gentileza?

Obrigada

> sqlite3@4.0.6 install D:\Elaine\Alura\React\curso-react-api\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.6/node-v72-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.6 and node@12.16.1 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(5
7,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 buil
d tools, please install v140 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecti
ng the Project menu or right-click the solution, and then selecting "Retarget solution". [D:\Elaine\Alura\React\curso-r
eact-api\node_modules\sqlite3\build\deps\action_before_build.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Elaine\Programas\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "D:\\Elaine\\Programas\\node.exe" "D:\\Elaine\\Programas\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=D:\\Elaine\\Alura\\React\\curso-react-api\\node_modules\\sqlite3\\lib\\binding\\node-v72-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\\Elaine\\Alura\\React\\curso-react-api\\node_modules\\sqlite3\\lib\\binding\\node-v72-win32-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd D:\Elaine\Alura\React\curso-react-api\node_modules\sqlite3
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'D:\Elaine\Programas\node.exe D:\Elaine\Programas\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\Elaine\Alura\React\curso-react-api\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\Elaine\Alura\React\curso-react-api\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\Elaine\Alura\React\curso-react-api\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Windows_NT 10.0.18362
node-pre-gyp ERR! command "D:\\Elaine\\Programas\\node.exe" "D:\\Elaine\\Alura\\React\\curso-react-api\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:\Elaine\Alura\React\curso-react-api\node_modules\sqlite3
node-pre-gyp ERR! node -v v12.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute 'D:\Elaine\Programas\node.exe D:\Elaine\Programas\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\Elaine\Alura\React\curso-react-api\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\Elaine\Alura\React\curso-react-api\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN curso-react-api@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.0.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.0.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MSI\AppData\Roaming\npm-cache\_logs\2020-04-20T21_05_19_225Z-debug.log
8 respostas

Fala ai Elaine, tudo bem? Tente fazer o seguinte:

  1. Apagar a pasta node_modules (caso existe).
  2. Apagar o arquivo package-lock.json (caso existe).
  3. Instalar tudo novamente: npm i.
  4. Rodar a API: npm start.

Espero ter ajudado.

solução!

Funcionou, obrigada!!!

Magina Elaine, sempre que precisar não deixe de criar suas dúvidas.

Abraços e bons estudos.

o meu ao apagar a pasta node_modules e dar o comando npm i deu mais erro ainda

O meu também não tinha funcionado, aí eu excluí o arquivo "na mão". Fui até a pasta e o arquivo "físico", deletei e depois voltei ao prompt e dei o "npm i" aí funcionou.

Henrique, tem que apagar o package-lock.json também.

Ok, Obrigado Olívia

Fala pessoal, é como a Olivia disse, além da pasta node_modules o arquivo package-lock.json também precisa ser apagado.

No caso seria os quatro passos da minha primeira resposta (não pulem o passo dois).

Abraços e bons estudos.