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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With