Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodemon not running due to requires update notifier package

When I typed "nodemon server.js" command in the terminal, it returns the error "require('update-notifier')({ pkg }).notify();". The version of nodemon installed is [email protected]

enter image description here

Below are the javascript and html used.

var express = require('express');
var app = express();
var port = 8888;

app.get('/', function(req, res, next) {
  res.sendFile(__dirname + '/index.html');
});

app.listen(port, '0.0.0.0', function() {
  console.log('Server running at port ' + port);
});
<!DOCTYPE html>
<html>

<head>
  <title>My NodeJS Website</title>
</head>

<body>
  <p>Hello World!</p>
</body>

</html>
like image 374
flyingspacecat Avatar asked Apr 15 '18 03:04

flyingspacecat


People also ask

How do I fix Nodemon is not working?

Use npx to solve the error "'nodemon' is not recognized as an internal or external command, operable program or batch file", e.g. npx nodemon server. js or install the package globally by running npm install -g nodemon and make sure your PATH environment variable is set up correctly.

How do you reload Nodemon?

Running non-Node code While Nodemon is running, we can manually restart our application. So instead of stopping and restarting Nodemon, we can just type rs and press enter, and Nodemon will restart the server or the running process for us.


1 Answers

That error is telling that your node version does not support object literal property value shorthand, which was introduced in node 4, which is the required version for nodemon.

You should update your node version, since it's not a nodemon issue.

To provide further proof, executing nodemon on a docker container with node 0.12.15 installed trigger that exact same error.

Node 0.12.15

enter image description here

And it doesn't happen on node >= 4

enter image description here

I recommend updating your node version to 8.11.1 which is the current LTS


If you can't upgrade your node version (which you should), you can downgrade nodemon to version 1.11.0 which runs on node >= 0.8.

enter image description here

like image 183
Marcos Casagrande Avatar answered Sep 29 '22 18:09

Marcos Casagrande