Search code examples
node.jsnodemon

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>


Solution

  • 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