Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot find module 'ms'

Tags:

node.js

module

I've been trying to get my app running for a few days now, but keep getting errors. I'm closer than I have been so far, but am now getting the "Cannot find module error" when trying to launch my application.

Below is the error I'm getting now.

C:\MY-APP\dataService>node dataAPI.js
module.js:338
    throw err;
          ^
Error: Cannot find module 'ms'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\MY-APP\node_modules\express\node_modules\debug
\debug.js:14:20)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

I also searched the forums for an answer to this question and found this post on Stack Overflow, but it was in reference to Azure, which I'm not using.

I'm new to Node.js so forgive me if I sound like I don't know what I'm talking about because that's largely the truth.

like image 843
lukeslytalker Avatar asked Aug 18 '15 15:08

lukeslytalker


People also ask

What is error Cannot find module?

The "Cannot find module" error in Node. js occurs for multiple reasons: Forgetting to install a third-party package with npm i somePackage . Pointing the node command to a file that doesn't exist.

What does it mean module not found?

The 'module not found' error is a syntax error that appears when the static import statement cannot find the file at the declared path. This common syntax error is caused by letter-casing inconsistencies that are present in your filename(s) between your repository and local machine, or both.

Can not find node module?

To fix the Cannot find module error, simply install the missing modules using npm . This will install the project's dependencies into your project so that you can use them. Sometimes, this might still not resolve it for you. In this case, you'll want to just delete your node_modules folder and lock file ( package-lock.


1 Answers

please see this Link : https://www.npmjs.com/package/ms

and use :

npm install ms -S

on your project its automatically save ms package to the node-module.

like image 123
nitesh singh Avatar answered Oct 04 '22 08:10

nitesh singh