1
resposta

Erro no npm run server: "Error: Cannot find module './node.js'"

Quando eu rodo "npm run server" dentro da pasta do projeto (que nomeei como 'ts'), recebo o seguinte erro:

internal/modules/cjs/loader.js:589
    throw err;
    ^

Error: Cannot find module './node.js'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
        at Function.Module._load (internal/modules/cjs/loader.js:513:25)
        at Module.require (internal/modules/cjs/loader.js:643:17)
        at require (internal/modules/cjs/helpers.js:22:18)
        at Object.<anonymous> (C:\Users\thiago.damasceno\Documentos\Programacao\Alura\ts\node_modules\serve-index\node_modules\debug\src\index.js:9:20)
        at Module._compile (internal/modules/cjs/loader.js:707:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
        at Module.load (internal/modules/cjs/loader.js:605:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
        at Function.Module._load (internal/modules/cjs/loader.js:536:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! alurabank@1.0.0 server: `lite-server --baseDir=dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the alurabank@1.0.0 server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1 resposta

Fala Thiago, tudo bem? Espero que sim!

Tente excluir a pasta node_modules e executar o comando npm install novamente para reinstalar as depêndencias, depois rode o comando npm run server denovo.

Caso o erro permanecer comenta aqui com a gente, ta bom?

Abraços e bons estudos :D