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

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.

Related

Phusion Passenger SyntaxError: Unexpected identifier at passenger _start_

I'm trying to install https://github.com/zadam/trilium.git on my A2 shared hosting server. The instructions for cPanel and SSH terminal both show a start command like:
passenger start --app-type node ./trilium/src/www app.js
But everything I try reports:
App 15779 output: passenger start --app-type node ./trilium/src/www app.js
App 15779 output: ^^^^^
App 15779 output: SyntaxError: Unexpected identifier
App 15779 output: at Module._compile (internal/modules/cjs/loader.js:723:23)
...
I'm new to Passenger, and don't have direct access to its setup. The techs at the hosting service seem equally lost. How can a statement that is recommended in all the help files fail at the first command?
Maybe it highlights start if any of the following parameters are wrong?
Maybe the command is being stored in the wrong location? But it finds that command when I try to Start Passenger...
That unhelpful error message, and a lot of similar ones, seems to have resulted from an initial failure to "npm install" my package.
When I tried a clean start of the whole process, using the terminal instead of cPanel, I had access to the logs from npm, and I found this:
...
> better-sqlite3#7.4.3 install /home/psychoro/trilium/node_modules/better-sqlite3
> prebuild-install || npm run build-release
prebuild-install WARN install /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/psychoro/trilium/node_modules/better-sqlite3/build/Release/better_sqlite3.node)
> better-sqlite3#7.4.3 build-release /home/psychoro/trilium/node_modules/better-sqlite3
> node-gyp rebuild --release
The session locked up there, and the system would not let me open another terminal to investigate. I resorted to ^C and my terminal access was restored. I suspect that corresponds to the event during my initial install when I was using cPanel and the access to all of it locked up with no explanation.
So all the useless error messages I saw later were produced by an installation that had crashed midway.
It does seem like "WARN" is a bit bland for a condition that kills the install and leaves chaos behind. And that "npm install" should be able to survive a missing file reference... But I suppose that isn't Phusion's responsibility...
Oh, and my command above was wrong:
passenger start --app-type node ./trilium/src/www app.js
should have been:
passenger start --app-type node --startup-file ./trilium/src/www
The guide I was following back then made it seem like "--startup-file" was a placeholder to be replaced by the name of my package's file. Still doesn't explain why it errored on "start" instead of my obvious error.
...

Error: Cannot find module 'C:\Users\Elie\Projects\MEAN\task-manager\api\index.js'

I have been following along this youtube playlist: https://www.youtube.com/watch?v=P3R-8jj3S7U. We got to the part where we finished a model and are ready to test. Run nodemoncommand to start the API and I get this error
Here is the file in question as well
Thanks for the help
UPDATE: In the package.json file i changed main to the exact file path of index.js you can see the package.json file here. This seemed to produce a better result but still didnt fix the issue. The error now reads clean - exit waiting for changes before restart and seems like it should be working but it isnt. I attached a sceengrab to have a better look. View Error
UPDATE #2: I changed the main property in the package.json file to app.js and ran nodemon command and produced this error. A bit of progress?
UPDATE #3: Here is my app.js file for reference
UPDATE #4: I updated my express property verision to include an actual verison number then ran npm install which seemed to be sucessful. I then ran nodemon again. Here are the results
Based on the information you've provided, I would guess you are executing nodemon by just typing the nodemon command without any arguments. This only works if your entry point is named index.js, but in the screenshot you provided it's clear that your entry point is named app.js, so you should be running nodemon with the following command:
nodemon app.js

Node can't start app due to missing module

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.

Almost finishing app and it started crashing

My app was working perfectly until I installed the accounts-facebook and service-configuration package. Now it's giving this error and I have absolutely no idea how to fix it:
/Users/###/.meteor/packages/meteor-tool/.1.1.3.1eul34x++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
throw(ex);
^
Error: Can't find npm module 'mongodb'. Did you forget to call 'Npm.depends' in package.js within the 'cfs_gridfs' package?
at Object.Npm.require (/Users/###/proyectos/leads/.meteor/local/build/programs/server/boot.js:155:17)
at Package (packages/cfs:gridfs/gridfs.server.js:2:1)
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/packages/cfs_gridfs.js:189:4
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/packages/cfs_gridfs.js:196:3
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/boot.js:222:10
at Array.forEach (native)
at Function._.each._.forEach (/Users/###/.meteor/packages/meteor-tool/.1.1.3.1eul34x++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/boot.js:117:5
Exited with code: 8
Your application is crashing. Waiting for file change.
What worked for me was simply hitting "Control + C" to stop my app and then running "meteor run" again.
Do you have the cfs_gridfs package?
Your console reference that package in the error
If you're using mrt it means that you're using an old version of Meteor. Once in a while I had similar issues and I would simply edit the file .meteor/packages and the problem was solved when I run meteor command. I'm not sure if the same applies here.

Error when starting Nodemon on my server.js file (Nodejs)

I recently started getting an error in my terminal when I start nodemon on my server.js file within my directory. Here is a picture below
Here is the error.
dyld: lazy symbol binding failed: Symbol not found: _node_module_register
Referenced from: /Users/dan/nodeStuff/crm-test/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build/Release/bson.node
Expected in: dynamic lookup
Not sure what the issue is. I did a brew update and also made sure my port was correct.
For anyone else who stumbles by this problem, I had the same issue when trying to start my server with nodemon.
For me, the problem was I was still using an older version of node with nvm. I switched back to the version appropriate for my application and problem solved!
Did you try running node server.js?
Maybe it's not nodemon.
I've looked around and I did a npm rebuild which helped. When I start nodemon server.js or node server.js it tells me that one of the packages I was using is depreciated, I'm guessing that's what threw the error. Not sure why body-parser is depreciated.

Resources