Flávio, poderiam me tirar uma dúvida? a api funciona na versão 10 do node? Caso não funcione poderiam realizar essa atualização.
Flávio, poderiam me tirar uma dúvida? a api funciona na versão 10 do node? Caso não funcione poderiam realizar essa atualização.
Boa tarde, Pedro! Como vai?
Não vejo motivo para não funcionar na versão 10 do Node! Que tipo de problema vc está tendo? Poderia descrever e mandar os logs de erro?
Olá Gabriel, obrigado por responder tão rápido.
Vou detalhar o erro abaixo: Meu windows é o 10 atualizado. Versão atual do node no meu desktop: v10.15.3
obs.: o nome do meu aplicativo é memories no lugar alurapic.
baixei a api através desse link: https://s3.amazonaws.com/caelum-online-public/865-angular/api-windows.zip
Entendo que o link já tem seu sqlite compilado.
ao acessar o repositório realizo o comando npm start e obtenho o erro:
/e/workspace/Angular/memories/api-windows (master) $ node -v v10.15.3
/e/workspace/Angular/memories/api-windows (master) $ npm start
alurapic@1.0.0 start E:\workspace\Angular\memories\api-windows node server.js
internal/modules/cjs/loader.js:584 throw err; ^
Error: Cannot find module 'sqlite3'
at Function.Module.resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module.load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (E:\workspace\Angular\memories\api-windows\config\database.js:1:79)
at Module.compile (internal/modules/cjs/loader.js:701:30)
at Object.Module.extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! alurapic@1.0.0 start: node server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the alurapic@1.0.0 start 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\8895\AppData\Roaming\npm-cache_logs\2019-06-27T16_19_51_317Z-debug.log
Não funcionou. Então eu fui no arquivo package.json e atualizei o "sqlite3": "^4.0.9" para essa versão que é a atual. e tentei executar o comando npm install e obtive um outro erro que vou colocar na resposta abaixo pois não cabe nesse comentário.
/e/workspace/Angular/memories/api-windows (mast $ npm install
sqlite3@4.0.9 install E:\workspace\Angular\memories\api-windows\nodeqlite3 node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp WARN Pre-built binaries not installable for sqlite3@4.0.910.15.3 (node-v64 ABI, unknown) (falling back to source compile with n node-pre-gyp WARN Hit error self signed certificate in certificate cha gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can sHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodedules\npm\node_modules\node-gyp\lib\configure.js:484:19) gyp ERR! stack at PythonFinder. (C:\Program Files\nodejules\npm\node_modules\node-gyp\lib\configure.js:509:16) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_moeful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:153:21) gyp ERR! System Windows_NT 10.0.17763 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Fis\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "confiallback-to-build" "--module=E:\workspace\Angular\memories\api-windmodules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node"name=nodesqlite3" "--module_path=E:\workspace\Angular\memories\a\node_modules\sqlite3\lib\binding\node-v64-win32-x64" "--napi_ver-node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node- gyp ERR! cwd E:\workspace\Angular\memories\api-windows\node_modules\sq gyp ERR! node -v v10.15.3 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodxe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\s configure --fallback-to-build --module=E:\workspace\Angular\memoriesws\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.noe_name=node_sqlite3 --module_path=E:\workspace\Angular\memories\api-wi_modules\sqlite3\lib\binding\node-v64-win32-x64 --napi_version=3 --nod=napi --napi_build_version=0 --node_napi_label=node-v64' (1) node-pre-gyp ERR! stack at ChildProcess. (E:\workspace\mories\api-windows\node_modules\node-pre-gyp\lib\util\compile.js:83:29 node-pre-gyp ERR! stack at ChildProcess.emit (events.js:189:13) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:9 node-pre-gyp ERR! stack at Process.ChildProcess.handle.onexit (inldprocess.js:259:5) node-pre-gyp ERR! System Windows_NT 10.0.17763 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "E:\wAngular\memories\api-windows\node_modules\node-pre-gyp\bin\node-install" "--fallback-to-build" node-pre-gyp ERR! cwd E:\workspace\Angular\memories\api-windows\node_mite3 node-pre-gyp ERR! node -v v10.15.3 node-pre-gyp ERR! node-pre-gyp -v v0.11.0 node-pre-gyp ERR! not ok Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\n_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallbac --module=E:\workspace\Angular\memories\api-windows\node_modules\sqlitding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 -th=E:\workspace\Angular\memories\api-windows\node_modules\sqlite3\lib\de-v64-win32-x64 --napi_version=3 --node_abi_napi=napi --napi_build_venode_napi_label=node-v64' (1) npm WARN alurapic@1.0.0 No description npm WARN alurapic@1.0.0 No repository field.
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! sqlite3@4.0.9 install: `node-pre-gyp install --fallback-to-bu npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the sqlite3@4.0.9 install script. npm ERR! This is probably not a problem with npm. There is likely addiging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\8895\AppData\Roaming\npm-cache_logs\2019-06-27T82Z-debug.log
como pode ver não funcionou, então tentei executar o comando npm install sqlite3 e obtive esse erro: /e/workspace/Angular/memories/api-windows (master) $ npm install sqlite3
sqlite3@4.0.9 install E:\workspace\Angular\memories\api-windows\node_modules\sqlite3 node-pre-gyp install --fallback-to-build
continuação desse err na proxima resposta:
/e/workspace/Angular/memories/api-windows (master) $ npm install sqlite3
sqlite3@4.0.9 install E:\workspace\Angular\memories\api-windows\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 Pre-built binaries not installable for sqlite3@4.0.9 and node@10.15.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error self signed certificate in certificate chain gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19) gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:153:21) gyp ERR! System Windows_NT 10.0.17763 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=E:\workspace\Angular\memories\api-windows\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=E:\workspace\Angular\memories\api-windows\node_modules\sqlite3\lib\binding\node-v64-win32-x64" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64" gyp ERR! cwd E:\workspace\Angular\memories\api-windows\node_modules\sqlite3 gyp ERR! node -v v10.15.3 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=E:\workspace\Angular\memories\api-windows\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=E:\workspace\Angular\memories\api-windows\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1) node-pre-gyp ERR! stack at ChildProcess. (E:\workspace\Angular\memories\api-windows\node_modules\node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:189:13) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:970:16) node-pre-gyp ERR! stack at Process.ChildProcess.handle.onexit (internal/childprocess.js:259:5) node-pre-gyp ERR! System Windows_NT 10.0.17763 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "E:\workspace\Angular\memories\api-windows\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd E:\workspace\Angular\memories\api-windows\node_modules\sqlite3 node-pre-gyp ERR! node -v v10.15.3 node-pre-gyp ERR! node-pre-gyp -v v0.11.0 node-pre-gyp ERR! not ok Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=E:\workspace\Angular\memories\api-windows\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=E:\workspace\Angular\memories\api-windows\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1) npm WARN alurapic@1.0.0 No description npm WARN alurapic@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.0.9 install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.0.9 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\8895\AppData\Roaming\npm-cache_logs\2019-06-27T16_27_34_527Z-debug.log
Basicamente é por esse problema que eu estou passando. Realizei algumas consultas em alguns sites como por exemplo o stack overflow e também verifiquei nosso forúm e nenhuma resposta conseguiu se encaixar a minha realidade.
1) Eu fiz a instalação do Sqlite3: npm install sqlite3 2) Eu reinstalai os pacotes: npm install 3) Startei o serviço de novo.: npm start
Eu resolvi da seguinte forma (Ubuntu):
sudo npm cache clean --force
sudo rm -rf node_modules
sudo npm install
sudo npm start
Espero que consiga ajudar alguém no futuro. Obrigado