Solve – cors problem


app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});

app.get('/', function(req, res, next) {
  // ....
});

app.post('/', function(req, res, next) {
 // ....
});



npm – Refusing to install gulp as a dependency of itself

Yeah, if the name of the package in package.json is “gulp”, then it will throw error. The name of the package is created when we run:

    npm init

“name”: “gulp”.

In other words the name of directory in which you are running the command will give a default package name and you need to change it, don’t leave to default.

Or simple edit the name in package.json to something other than gulp.