Error: Cannot find module 'ms'

11,240

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.

Share:
11,240
Admin
Author by

Admin

Updated on June 11, 2022

Comments

  • Admin
    Admin almost 2 years

    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.

  • Admin
    Admin over 8 years
    Is that what the -S is for? I found once I installed "ms" I have a bunch of other dependencies it's looking for. Thanks for sending me in the right direction. So should I add -S to all modules I want in my node-module directory?
  • Nitesh singh
    Nitesh singh over 8 years
    -S is used for set dependency on package JSON for next time use.
  • Admin
    Admin over 8 years
    Goctha. Thanks so much Nitesh.