Node.js Error: Cannot find module express

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

    In your case your express module is installed at C:\Users\Dmitry\AppData\Roaming\npm\node_modules\express, but you need to get this module in to your project directory. So you should copy the file the express module folders from C:\Users\Dmitry\AppData\Roaming\npm\node_modules\ to your project directory as : C:\ChatServer\Server\node_modules. If you do not have a folder named 'node_modules' in your project folder, then create it first and paste those files into this folder. This method worked for me on my windows pc. Restart your node server and once again run the command node C:\ChatServer\Server>node server.js. It should work now !!!!

提交回复
热议问题