Node can't start app due to missing module - node.js

I have an application that I am running for the first time in a new computer. I keep getting the following error when starting the app
Error: Cannot find module './src/async'
I checked the application directory and I see the module there. I have tried re-installing the module and doing npm install and still no luck.

Related

My nodemon app crashed after updating npm. What to do?

I went ahead and used npm update in my terminal(hyper) and when I tried to restart my app.js server, I got an error stating
[nodemon] app crashed - waiting for file changes before starting...
I thought I needed to use this command (npm update) in order to update my node modules, but then for some reason, some modules got deleted. ("Error: Cannot find module 'parseurl'"). I'm still a newbie to development and have no clue where to go from here. What to do?
Here's a screenshot of the error in my terminal.
screenshot of error
Nodemon tried to start the server, but it won't start successfully if it can't find the module you are referencing. Try reinstalling "parseurl" npm i parseurl and make sure the path to the module is correct. Once you have done that, the server should start successfully pending any other issues.

PM2 cluster mode Cannot find module

I used pm2 for run my nodejs application for production in cluster mode.
The problem is after I check the error logs I find these weird logs:
Cannot find module 'winston'
Cannot find module '#turf/destination'
Cannot find module 'apollo-server-redis'
Cannot find module ...
They are just random package names and I have installed theme and they work fine but only SOMETIMES they act weird and cause problem in my web application.
Is this problem related to PM2 or my packages or my code?
What should I do?
try sudo pm2 update - could be that your node_modules folder isn't in the correct folder aswell...

NodeJS Windows 10 geolocation module throws error in electron when the app starts

I was using module "#nodert-win10-rs4/windows.devices.geolocation" in an electronjs app which was working fine. Later I installed a node module and rebuilt all the modules. Now it stopped working and throwing error. The previous version of that module ( "#nodert-win10-rs4/windows.devices.geolocation") was 1.0.0, Thus I reinstalled it, new version of the module is "0.3.2" but still error. Even i tried this in fresh new electron quick start app and I see the same error. I'm adding here the screenshot of the package.json and the error. (FYI - The module is installed and rebuilt without any error although it has some warning, I've added a screenshot of the installation/built too). Really appreciate any help/suggestions.
I saw other posts with similar errors but I already took the actions mentioned there.
Thanks
Musa
N.B - Cross posted here
I ran into the same issue and here is how I resolved it.
Copy the windows.devices.geolocation into your electron app folder and update the dependencies to point to the location of the folder. You need to this line added to your package.json of your Electron App
"windows.devices.geolocation": "file:windows.devices.geolocation"
Navigate to the newly copied folder and build your NodeRT "addon" to match your Electron version. See this post here NodeRT with Electron
node-gyp rebuild --target=4.0.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell
Run npm install at the the top level Electron app.

Error: Could not locate bindings file node-librdkafka.node

Suddenly I have started seeing below error while running a Node.js app using node-rdkafka. It was working before, not sure what triggered this error.
Error: Could not locate the bindings file. Tried
-> /home/...../node-librdkafka.node ...
I tried npm install, npm rebuild, all of them work without giving any issue, just that the bindings do not get created.
this is on debian-jessie guest in Virtual box running on Windows as host.
Thanks!
npm install node-rdkafka resolved this issue.

Message "Failed to instantiate module growlNotifications..." appear on production env

I am current using mean.io as development framework of my application and have been using growlNotifications plug-in for certain time and it works perfect on both server and client side.
while after some coding commit (does not affect the plug-in), the following error appear on the production server:
Uncaught Error: [$injector:modulerr] Failed to instantiate module acleague due to:
Error: [$injector:modulerr] Failed to instantiate module growlNotifications due to:
Error: [$injector:nomod] Module 'growlNotifications' is not available! You either...<omitted>...3)
but it won't have any problem running on local. I ensure that the bower install work perfectly on production server and i did nth in the grunt file.
Could anyone help me or even give me some hints to solve this problem? Thanks a lot!
As I was set the bower component as latest, the production server will run the bower update command to get the latest one while local does not.
So I upgraded the plugin and run it on both sides, it works now.

Resources