Node.js Error: Cannot find module express

前端 未结 15 1531
情话喂你
情话喂你 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:22

    Golo have explain well the solution, but I might add a clarification:
    sometimes node modules are installed in

    /usr/local/lib/node_modules
    

    and when you launch node blabla.js modules are searched in

    /lib
    

    So a solution is to create a symbolic link:

    sudo ln -s /usr/local/lib/node_modules/ /lib/node_modules
    

提交回复
热议问题