Express module not found when installed with NPM

后端 未结 14 1573
庸人自扰
庸人自扰 2020-12-22 22:59

When I try to run the app.js file created by express, I get the following error:

$ node app.js

node.js:134
        throw e; // process.nextTick         


        
14条回答
  •  借酒劲吻你
    2020-12-22 23:12

    For all problems with express with a mac computer:

    The solution is:

    1. chown to your user the .npm folder :

      sudo chown -R Webmaste /Users/webmaste/.npm/
      
    2. At your test folder or your folder:

      sudo npm install -g express@2.5.8
      
    3. Invoke express from your actual location:

      /usr/local/share/npm/bin/express
      
    4. sudo cd . && npm install

    5. Finally:

      node app
      

    the final message in the console should look like this:

    Express server listening on port 3000 in development mode

提交回复
热议问题