module.js:338 throw err in node.js

前端 未结 6 552
陌清茗
陌清茗 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:41

    I also got the same issue , u should try npm install , npm update is also an option but with npm update latest npm version will be installed in your local environement . This is not desirable for global project as u may find unmet dependencies issue at global environment then.

    I would suggest use npm install

    0 讨论(0)
  • 2021-02-08 01:45

    npm update

    I see this when the module install order is not perfect, or multiple modules exist.

    npm update sorts this out deprecating the incorrect versions.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-08 01:55

    It seems like the script has an unmet dependency - meaning you have to install the module "merge-descriptors" first.

    It also seems like the script is using "express" (and "merge-descriptors" actually looks like a dependency of "express") - because this didn't throw an error some dependencies seem to be installed already.

    So you could try to install the missing ones via npm install or npm update.

    Update: According to npmjs.org "merge-descriptors" is an dependency of "express". Looking at your stacktrace shows that you have "express" installed globally - so you should try npm update -g

    If that doesn't solve your problem you should have a look at this question.

    0 讨论(0)
  • 2021-02-08 02:02

    you should install merge-descriptors module. Open your terminal or command prompt and run this command:

    npm install --save merge-descriptors
    
    0 讨论(0)
  • 2021-02-08 02:06

    This error occurs when module name and file name does not match. It's resolved after using the same name for module and file name. e.g.

    module - Hello,
    File name - Hello.js
    
    0 讨论(0)
提交回复
热议问题