What is the issue "node" is working but "nodemon" is not woking on windows 7 64-bit in node.js? - node.js

I am new to node.js. node is working fine but when I installed the nodemon package, it gives an error: exception in nodemon killing node, even when installed globally.
22 Jun 13:07:29 - [nodemon] v1.3.7
22 Jun 13:07:29 - [nodemon] to restart at any time, enter `rs`
22 Jun 13:07:29 - [nodemon] watching: *.*
22 Jun 13:07:29 - [nodemon] starting `node server.js`
exception in nodemon killing node
Error: spawn cmd ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
----------------------------------------------------------
If appropriate, please file an error with the output from:
$ node
C:\Users\username\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.
js server.js --dump
At http://github.com/remy/nodemon/issues/new

Possible solutions.
1. Permissions
The problem may be in your file permissions. Execute in git bash or from windows to give full permission to the project folder.
$ chmod -R 777 [folder]
2. Environment Variables
Missing "C:\Windows\System32" in the PATH.
Github issue
3. Reinstall
Altogether remove nodemon using npm and try reinstalling.
npm uninstall -g nodemon
4. Update nodejs
If you have an old version of NodeJS, try updating it. I prefer entirely removing NodeJS and reinstalling it again.
Step by steps to remove NodeJS in windows
Note: Your question may not be rich enough to answer correctly. Please include more information about questions if those didn't work.

Help spawn to locate your nodemon.cmd like this:
var nodemonCmd = (process.platform == 'win32') ? 'node_modules\\.bin\\nodemon.cmd' : 'nodemon'
myApp = spawn(nodemonCmd, ['build/server.bundle']);
Hope it works :)

Related

Unable to launch nodemon environment

I'm trying to start my server with nodemon, but it crashes with the following output.
The error ERROR: Unrecognized environment. Aborting. seems quite rare, from a Google search.
Ran the same code in Windows 10 and a WSL2 Ubuntu set up. Both had the same results. The server does start for my coworker for some reason, though.
user#LAPTOP:~/myproject$ npm run start:dev
> myproject#0.0.0 start:dev /home/user/myproject
> nodemon
[nodemon] 2.0.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/*
[nodemon] watching extensions: ts,html
[nodemon] starting `./node_modules/.bin/ts-node -r tsconfig-paths/register ./src`
[2021-03-23T04:11:42.704Z] ERROR: Unrecognized environment. Aborting.
[nodemon] app crashed - waiting for file changes before starting...
^C
user#LAPTOP:~/myproject$ npm -v
6.14.11
user#LAPTOP:~/myproject$ node -v
v15.12.0
This is a bug with my sequelize code
The issue came from trying to access the sequelize.js database before connecting to it.
Moving my Model.findAll() statement to after the app has launched has fixed the issue.

Fatal error in toast.exe when compiling app.js

I have never seen this one before:
[nodemon] restarting due to changes...
Fatal error: spawn C:\Users\DonTron\Documents\GitHub\dev-thaihome\api\node_modules\grunt-notify\bin\toaster\toast.exe ENOENT
Completed in 2.163s at Tue May 30 2017 20:52:12 GMT+0700 (SE Asia Standard Time) - Waiting...
[nodemon] starting `node app.js`
Anyone knows what it is and how I should deal with it?
The reason for this error was that I forgot to install grunt-notify
This did the trick
npm uninstall grunt-notify
npm install grunt-notify
👍 1

Nodeclipse + nodemon error

When I try to run an express app in nodeclipse, it gives me the error,
23 Jan 11:58:04 - [33m[nodemon] v1.0.13[39m
23 Jan 11:58:04 - [33m[nodemon] to restart at any time, enter rs[39m
23 Jan 11:58:04 - [33m[nodemon] watching: .[39m
23 Jan 11:58:04 - [32m[nodemon] starting node
/home/rdteam/workspace/NedvedNodeExpressTest/app.js[39m
[31m[nodemon] unable to run executable: "node"[39m
However, when I run from command line that
node /home/rdteam/workspace/NedvedNodeExpressTest/app.js
or
nodemon /home/rdteam/workspace/NedvedNodeExpressTest/app.js
both work without problem.
Pls help.
Regards
Hammer
In my case (running os x) I quick solved it setting the full path in :
/usr/local/lib/node_modules/nodemon/lib/monitor/run.js
function run(options) {
var cmd = config.command.raw;
//Added line
cmd.executable = '/usr/local/bin/node';
I was able to solve this problem by using the forever module, and configuring Nodeclipse's 'Node monitor path' to point to forever (*../npm/node_modules/forever/bin/forever*)
npm install forever
Open Eclipse -> Preferences -> Nodeclipse
Set the 'Node monitor path' to your installation of forever, and you're done.
I ran headlong into this problem whilst setting up Nodeclipse, and getting my node programs to work on Eclipse Kepler running on Mac OS X 10.8.5 (Mountain Lion)
The use case "Nodeclipse with nodemon":
Nodeclipse 0.9 Eclipse 4.2.2 Java 1.7 on win32
Configure Nodeclipse with monitor path C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js
logilog.js with console.log('done');
Run As -> Node with monitor
Produced command line (seen in Nodeclipse Console):
node --harmony C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js D:\Workspaces\ADT-Bundle\CountingServer\try\logilog.js
Console output
23 Jan 16:23:35 - [33m[nodemon] v0.7.10[0m
Error: ENOENT, no such file or directory 'D:\Workspaces\ADT-Bundle\CountingServer\try\undefined\nodemonCheckFsWatch1390465415226'
at Object.fs.openSync (fs.js:427:18)
at Object.watchFileChecker.check (C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js:154:22)
at ready (C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js:49:22)
at testAndStart (C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js:71:5)
at Object.<anonymous> (C:\Users\weibl\AppData\Roaming\npm\node_modules\nodemon\nodemon.js:847:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
23 Jan 16:23:35 - [33m[nodemon] to restart at any time, enter `rs`[0m
23 Jan 16:23:35 - [32m[nodemon] watching: D:\Workspaces\ADT-Bundle\CountingServer\try[0m
23 Jan 16:23:35 - [nodemon] exception in nodemon killing node
Created issues #118 https://github.com/Nodeclipse/nodeclipse-1/issues/118
That is how issues are reported.
Thank you for letting know that you need this. Check http://www.nodeclipse.org/ on news and how to help.
If you create a nodemon.json config file in your application folder (e.g. /home/rdteam/workspace/NedvedNodeExpressTest/nodemon.json) with the following JSON it should work without having to modify the Nodemon source files.
{
"exec": "/usr/local/bin/node"
}
This work on OS X, you may need to change the path depending on where you have node installed.
Details on Nodemon config files:
https://github.com/remy/nodemon#config-files

error when starting the server with grunt or node server

I am trying to use the mean stack as described here : http://mean.io/
after install, when making "grunt", there is an error :
debugger listening on port 5858
4 Jan 01:47:40 - [nodemon] reading ignore list
Express app started on port 3000
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74)
at EventEmitter.emit (events.js:106:17)
at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
at EventEmitter.emit (events.js:98:17)
at Socket.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:478:10)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
4 Jan 01:47:40 - [nodemon] app crashed - waiting for file changes before starting...
I tried the troubleshooting as specified on the site : Updating Grunt, bower and cleaning npm and bower caches worked well. but updating npm gives an error too:
npm ERR! error rolling back Error: Refusing to delete: /usr/local/bin/npm not in /usr/local/lib/node_modules/npm
This looks like a conflict between homebrew and npm.
but anyway i have version 1.3.21 installed.
There is the same error when i am trying node server.
do you have an idea on what i can do to make the server work ?
It may be too easy, but seems like your MongoDB server is not actually running. After having installed Mongo (on your Mac, I assume?), you have to open a Terminal window/tab, run mongod and leave it running (or use screen, etc.). You can try to access MongoDB CLI by typing mongo to make sure the server is running.
#desgnl: if you don't want to run mongod command everytime you are running the grunt, you can always use third party services like MongoDB Hosting: Database-as-a-Service by MongoLab https://mongolab.com Hope this helps too!

Nodeclipse + Nodemon dont want to start apps

i set in prefences in Node Path C:!NnS\NodeJS!LIBS\nodemon.cmd
nodemod.cmd
"%~dp0\node.exe" "%~dp0\node_modules\nodemon\nodemon.js" %*
error
21 Aug 17:12:11 - [33m[nodemon] v0.7.10[0m
21 Aug 17:12:11 - [33m[nodemon] to restart at any time, enter rs[0m
21 Aug 17:12:11 - [32m[nodemon] watching: C:\Users\Admin\Desktop\nodeclipse-NTS-jee-kepler-win64\ws\NodeProject-1[0m
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
21 Aug 17:12:11 - [32m[nodemon] starting node C:\Users\Admin\Desktop\nodeclipse-NTS-jee-kepler-win64\ws\NodeProject-1\hello-world-server.js[0m
21 Aug 17:12:11 - [nodemon] exception in nodemon killing node
if i will start "nodemod.cmd app.js" all works
ps.
nodemon plugins for whatch on filechanges and make restart on any changes
https://github.com/remy/nodemon
Running node application with node-dev, forever, supervisor, nodemon etc
as of Nodeclipse 0.4.0 is not yet supported, issue #57 https://github.com/Nodeclipse/nodeclipse-1/issues/57
It is really smart to try enter path to such utils into Node path Preferences settings,
but it is not how that setting is meant to be used.
UPDATE (The solution you have mentioned) run app with a wrapper:
Looks like if in main app will be something like this... all will be ok :)
spawn("nodemon.cmd", ["main.js"]...
and
spawn("nodemon",[" --debug ./server.js 80"]...
But I personally would prefer to open console with StartExplorer see Plugins List
(right-click project -> StartExplorer -> open shell)
then nodemon main

Resources