node.js, Error: Cannot find module 'express'

后端 未结 18 1879
情话喂你
情话喂你 2020-12-02 08:57

I am new to Node.js, try to learn express to build my first web application. I got stuck on my very first sample code and need some help to get it running. Before I post th

18条回答
  •  执笔经年
    2020-12-02 09:46

    if youre main file is located at /Users/feelexit/WebstormProjects/learnnode/node_modules/index.js then express needs to be located at /Users/feelexit/WebstormProjects/learnnode/node_modules/node_modules as node always looks for modules in ./node_modules (and its internal folder) when the path dont start with ./ or / (more info here)

    i think you miss placed youre main file in the module folder

提交回复
热议问题