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;
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
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.
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.
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.
you should install merge-descriptors module. Open your terminal or command prompt and run this command:
npm install --save merge-descriptors
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