8
respostas

npm start nao funciona

Ola gente, ha dias que estou tentando, ja reinstalei o node, ja tentei o npm audit fix.. e nao consigo..

aqui vai o erro

> agenda-petshop@1.0.0 start
> nodemon server.js

[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
node:internal/modules/cjs/loader:928
  throw err;
  ^

Error: Cannot find module 'C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\node_modules\sqlite3\lib\binding\node-v88-win32-x64\node_sqlite3.node'
Require stack:
- C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\node_modules\sqlite3\lib\sqlite3.js
- C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\node_modules\sqlite\main.js
- C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\infraestrutura\database\tabelas.js
- C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\node_modules\sqlite3\lib\sqlite3.js:4:15)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\JANIO\\Desktop\\estudos\\1526-FetchAPI-aula2\\server-petshop\\node_modules\\sqlite3\\lib\\sqlite3.js',
    'C:\\Users\\JANIO\\Desktop\\estudos\\1526-FetchAPI-aula2\\server-petshop\\node_modules\\sqlite\\main.js',
    'C:\\Users\\JANIO\\Desktop\\estudos\\1526-FetchAPI-aula2\\server-petshop\\infraestrutura\\database\\tabelas.js',
    'C:\\Users\\JANIO\\Desktop\\estudos\\1526-FetchAPI-aula2\\server-petshop\\server.js'
  ]
}
[nodemon] app crashed - waiting for file changes before starting...

e ai fica assim e nao sai disso nunca.. alguem pode me ajudar? :(

8 respostas

Oi Maristela, boa noite.

Tenta rodar na sequência:

npm -g uninstall nodemon --save
npm install nodemon@1.10.2 --dev
npm install
npm start

Me avisa se deu certo!

Ola Francisco

o erro persiste

> agenda-petshop@1.0.0 start
> nodemon server.js

[nodemon] 1.10.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] starting `node server.js`
node:internal/modules/cjs/loader:928
  throw err;
  ^

Error: Cannot find module 'C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\node_modules\sqlite3\lib\binding\node-v88-win32-x64\node_sqlite3.node'
Require stack:
- C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\node_modules\sqlite3\lib\sqlite3.js
- C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\node_modules\sqlite\main.js
- C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\infraestrutura\database\tabelas.js
- C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (C:\Users\JANIO\Desktop\estudos\1526-FetchAPI-aula2\server-petshop\node_modules\sqlite3\lib\sqlite3.js:4:15)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\JANIO\\Desktop\\estudos\\1526-FetchAPI-aula2\\server-petshop\\node_modules\\sqlite3\\lib\\sqlite3.js',
    'C:\\Users\\JANIO\\Desktop\\estudos\\1526-FetchAPI-aula2\\server-petshop\\node_modules\\sqlite\\main.js',
    'C:\\Users\\JANIO\\Desktop\\estudos\\1526-FetchAPI-aula2\\server-petshop\\infraestrutura\\database\\tabelas.js',
    'C:\\Users\\JANIO\\Desktop\\estudos\\1526-FetchAPI-aula2\\server-petshop\\server.js'
  ]
}
[nodemon] app crashed - waiting for file changes before starting...

Oi! Estou com o mesmo erro. Já reinstalei tudo e nada. :(

Christopher, você conseguiu resolver? Não consegui ainda, estou esperando alguém postar uma solução.

Oi Maristela tudo bem?

Nessa aula eu faço o npm install dentro do servidor para inicializar, então ao invés de digitar o npm install vamos remover o node_modules com o seguinte comando:

rm -rf node_modules

Aqui eu recomendo reiniciar o computador para evitar qualquer possível erros

Depois entra na pasta do server-petshop e faz

npm install

e depois

npm start

E me diz se funcionou por favor :)

Olá! Entao, quando eu digito o:

rm -rf node_modules

Aparece assim:

Remove-Item : Não é possível localizar um parâmetro que coincida com o nome de parâmetro 'rf'.
No linha:1 caractere:4
+ rm -rf node_modules
+    ~
    + CategoryInfo          : InvalidArgument: (:) [Remove-Item], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

O nome do arquivo para download é o server-petshop-master, dentro dele está o arquivo do server-petshop, uma das possibilidades do erro é que talvez os comandos npm install e npm start foram rodados dentro da primeira pasta e não da segunda .

Temos que fazer fazer:

cd server-petshop-master
cd server-petshop

e depois npm install

O que eu recomendo aqui é baixar o arquivo do servidor novamente e depois de descompactar, abrir ele em um outro vscode e fazer o npm install.

Sobre o erro do node_modules, uma alternativa é entrar na pasta do server-petshop e excluir manualmente a pasta node_modules clicando com botao direito do mouse e indo em exlcuir. Feito isso você faz o npm install novamente.

Continua dando o mesmo erro.. Exclui a pasta e continua dando erro. Baixei os arquivos da aula certinho e continua dando erro. E inclusive, estou fazendo na pasta certa. Segue o erro:

Windows PowerShell
Copyright (C) Microsoft Corporation. Todos os direitos reservados.

Experimente a nova plataforma cruzada PowerShell https://aka.ms/pscore6

PS C:\Users\JANIO\Desktop\1526-FetchAPI-aula3> cd server-petshop-master
PS C:\Users\JANIO\Desktop\1526-FetchAPI-aula3\server-petshop-master> cd server-petshop
PS C:\Users\JANIO\Desktop\1526-FetchAPI-aula3\server-petshop-master\server-petshop> npm install
npm ERR! code 1
npm ERR! path C:\Users\JANIO\Desktop\1526-FetchAPI-aula3\server-petshop-master\server-petshop\node_modules\sqlite3
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@15.5.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.1 found at "C:\Python39\python.exe"
npm ERR! gyp ERR! find VS 
npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config
npm ERR! gyp ERR! find VS - looking for Visual Studio version 2017
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2019 (16.8.30907.101) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" 
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - found VC++ toolset: v142
npm ERR! gyp ERR! find VS - found Windows SDK: 10.0.18362.0
npm ERR! gyp ERR! find VS - msvs_version does not match this version
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use  
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 valid versions for msvs_version:
npm ERR! gyp ERR! find VS - "2019"
npm ERR! gyp ERR! find VS - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:340:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:376:20)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1063:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19041
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\JANIO\Desktop\1526-FetchAPI-aula3\server-petshop-master\server-petshop\node_modules\sqlite3
npm ERR! gyp ERR! node -v v15.5.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\JANIO\AppData\Local\npm-cache\_logs\2021-01-13T13_53_00_303Z-debug.log
PS C:\Users\JANIO\Desktop\1526-FetchAPI-aula3\server-petshop-master\server-petshop>