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.
Related
when i run this command:>npm run dev
restapi#1.0.0 dev
nodemon index.js
[nodemon] 2.0.20
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node index.js
Error while connecting
db = client.db('Aug_22');
^
TypeError: Cannot read properties of undefined (reading 'db')
trying to connect to live mongodb
It seems that it is not nodemon that makes problem, it is database connection probably.
Check the way you defined your client. Suppose there is some mistake, as error refers...
npm start
start
nodemon index.ts
[nodemon] 2.0.15
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: ts,json
[nodemon] starting ts-node index.ts
'ts-node' is not recognized as an internal or external command, operable program or batch file
[nodemon] app crashed - waiting for file changes before starting...
Reinstall after npm install -gts-node, everything is the same error.
I am just getting started with node. I have installed the nodemon using the command npm install -g nodemon now whenever I start my server using nodemon server.js it starts fine but as I make some changes to the code it just keeps on restarting the server which doesn't execute the code in the file, so my progress is not saved.
Ansh#LAPTOP-7QQ43AM7 MINGW64 /f/files/atom/Web Development/my-express-server
$ nodemon server.js
[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
Server has started on port 3000
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
Instead of starting the server again after restarting, it just stays in the restarting process
I have an application running on a node server. The application is running fine, but unfortunately I do not see any logs in the terminal window. When I do npm start, I get the following output in the terminal:
> app#0.1.0 start /Users/prerak/WebProjects/app/www
> grunt
Running "jshint:all" (jshint) task
Running "csslint:all" (csslint) task
Warning: Unable to read ".csslintrc" file (Error code: ENOENT). Used --force, continuing.
Running "concurrent:default" (concurrent) task
Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/views/**/*.* gruntfile.js server.js config/**/*.js app/**/*.js
[nodemon] starting `node --debug server.js`
I have some calls to console.log in my server.js file but I do not see them in the terminal. Is there anything else that I can do to get the logs?
For the application without any errors it's fine but if there are any issues, it's very difficult to debug the issue. In case of an error, I get the following in the logs:
> app#0.1.0 start /Users/prerak/WebProjects/app/www
> grunt
Running "jshint:all" (jshint) task
Running "csslint:all" (csslint) task
Warning: Unable to read ".csslintrc" file (Error code: ENOENT). Used --force, continuing.
Running "concurrent:default" (concurrent) task
Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/views/**/*.* gruntfile.js server.js config/**/*.js app/**/*.js
[nodemon] starting `node --debug server.js
[nodemon] app crashed - waiting for file changes before starting...
I do not get any stackstace of the issue.
I have also configured my express server to show the stacktrace as:
var app = express();
app.set('showStackError', true);
I have this issue on Mac OSX 10.12 but if I run the same code on Ubuntu 14.10, it shows the logs in the terminal.
Also, instead of npm start if I do node server.js it shows the logs. What can be the reason behind this?
Can't seem to get nodemon up and running.
It works when using just node (node app.js) but when using nodemon (nodemon app.js) the following Emfile error is returned:
20 Nov 12:26:33 - [nodemon] v0.7.10
20 Nov 12:26:33 - [nodemon] to restart at any time, enter `rs`
20 Nov 12:26:33 - [nodemon] watching: /home/ramzi/ST/swaggertrack
20 Nov 12:26:33 - [nodemon] starting `node app.js`
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
Express server listening on port 80
mongo is connected
EMFILE: Watching too many files.
EMFILE: Watching too many files.
EMFILE: Watching too many files.
EMFILE: Watching too many files.
Has anyone got any thoughts?
Thanks.
If you update to nodemon#1.0.12 (currently latest) it will warn out if there's too many files being watched (i.e. > 25,000 files - a rough arbitrary number I chose). If you don't get that warning, it's possible it's your script.
Happy to help debug (assuming you're on the latest version) at http://github.com/remy/nodemon/issues/new