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

Erro ao subir servidor : Error: Cannot find module 'express'

Atualizei o angular e agora recebo a mensagem abaixo quando tento subir o servidor. Alguém tem alguma idéia ?

C:\sergio\cursos\alurapic\server>npm start

> alurapic@1.0.0 start C:\sergio\cursos\alurapic\server
> node server.js

module.js:471
    throw err;
    ^

Error: Cannot find module 'express'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\sergio\cursos\alurapic\server\config\express.js:1:
77)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
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 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the alurapic package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs alurapic
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls alurapic
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\sergio\cursos\alurapic\server\npm-debug.log
6 respostas

Sérgio, aparentemente alguns módulos do node não foram encontrados tipo o Express, poderia rodar um npm install novamente e me falar o resultado?

Rodei no server, segue o log:

C:\sergio\cursos\alurapic\server>npm install
array-flatten@1.1.1 node_modules\express\node_modules\array-flatten -> node_modu
les\array-flatten
cookie-signature@1.0.6 node_modules\express\node_modules\cookie-signature -> nod
e_modules\cookie-signature
merge-descriptors@1.0.1 node_modules\express\node_modules\merge-descriptors -> n
ode_modules\merge-descriptors
methods@1.1.2 node_modules\express\node_modules\methods -> node_modules\methods
mime@1.3.4 node_modules\express\node_modules\send\node_modules\mime -> node_modu
les\mime
on-finished@2.3.0 node_modules\body-parser\node_modules\on-finished -> node_modu
les\on-finished
path-to-regexp@0.1.7 node_modules\express\node_modules\path-to-regexp -> node_mo
dules\path-to-regexp
unpipe@1.0.0 node_modules\body-parser\node_modules\raw-body\node_modules\unpipe
-> node_modules\unpipe
utils-merge@1.0.0 node_modules\express\node_modules\utils-merge -> node_modules\
utils-merge
- raw-body node_modules\body-parser\node_modules\raw-body
- parseurl@1.3.1 node_modules\express\node_modules\parseurl
- send node_modules\express\node_modules\send
alurapic@1.0.0 C:\sergio\cursos\alurapic\server
`-- body-parser@1.18.1
  +-- bytes@3.0.0
  +-- content-type@1.0.4
  +-- debug@2.6.8
  | `-- ms@2.0.0
  +-- depd@1.1.1
  +-- http-errors@1.6.2
  | +-- inherits@2.0.3
  | +-- setprototypeof@1.0.3
  | `-- statuses@1.3.1
  +-- iconv-lite@0.4.19
  +-- qs@6.5.1
  +-- raw-body@2.3.2
  `-- type-is@1.6.15
    `-- mime-types@2.1.17
      `-- mime-db@1.30.0

npm WARN alurapic@1.0.0 No description
npm WARN alurapic@1.0.0 No repository field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! path C:\sergio\cursos\alurapic\server\node_modules\express\node_modules
\send\node_modules\.bin\mime
npm ERR! code EEXIST

npm ERR! Refusing to delete C:\sergio\cursos\alurapic\server\node_modules\expres
s\node_modules\send\node_modules\.bin\mime: is outside C:\sergio\cursos\alurapic
\server\node_modules\express\node_modules\send\node_modules\mime and not a link
npm ERR! File exists: C:\sergio\cursos\alurapic\server\node_modules\express\node
_modules\send\node_modules\.bin\mime
npm ERR! Move it away, and try again.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\sergio\cursos\alurapic\server\npm-debug.log

Mario, alguma idéia ?

solução!

Você usa Windows? Está com problemas de permissão. Sugiro remover tudo e instalar o Node 8.0.

Sérgio, sugiro reinstalar o node também, seguindo a dica do Flávio

Funcionou reinstalando tudo! Valeu pessoal.