module.js:338 throw err in node.js

前端 未结 6 546
陌清茗
陌清茗 2021-02-08 01:31

I\'m using ubuntu and I\'m trying to run a script using nodejs and i\'m getting this error.

/home/bebz/Documents/test# node server.js
module.js:338
throw err;
           


        
6条回答
  •  说谎
    说谎 (楼主)
    2021-02-08 01:51

    Whenever you get module.js:338 throw err; try to check whether npm is installed in your machine or not.

    UserName$ npm -v
    

    If you get the version name, then it's clear that npm is installed.

    If you don't get the version name, there is some problem with your installation or it is not installed.

    To install npm, type this command in your Terminal:

    UserName$ curl -0 -L http://npmjs.org/install.sh | sudo sh
    

    Also notice I added sudo before the sudo sh command depending on your users permissions.

提交回复
热议问题