Express module not found when installed with NPM

后端 未结 14 1550
庸人自扰
庸人自扰 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:17

    I installed gulp and when I ran this gulp command in the command line I got a gulp: command not found error. It appeared that it installed gulp in my local folder that is /home/YOURUSERNAME/.node/lib/node_modules and not in the global npm folder.

    You can check npm root folder by running this command: npm root -g, which was returning my personal directory /home/YOURUSERNAME/.node/lib/node_modules and not the expected /usr/local/lib/node_modules.

    You can fix this by running npm config set prefix /usr/local command.

提交回复
热议问题