Node.js Error: Cannot find module express

前端 未结 15 1538
情话喂你
情话喂你 2020-12-22 18:56

I wrote my first node.js app, but it can\'t find express library:

C:\\ChatServer\\Server>node server.js

module.js:340
    throw err;
          ^
Error: C         


        
15条回答
  •  清歌不尽
    2020-12-22 19:02

    I hit the same problem. I had express installed globally at /usr/local/bin/. When I do 'npm install', express was not created in node_modules of local directory.

    1. Check if you have file name .npmrc in your $HOME
    2. If it has 'global = true', change to 'global = false'
    3. Now do 'npm install' in application directory. More likely, you should get all package dependent modules installed in node_modules (local) within application directory.

提交回复
热议问题