科尔多瓦:找不到模数体解析器

时间:2015-10-01 07:44:39

标签: node.js cordova ionic

我已在我的根控制台上运行此命令

npm install --save 

在我的文件夹的根目录 这是我的ionic-gcm.js的片段

var app = express();


var bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());


var server = app.listen(3000, function(){

  var host = server.address().address
  var port = server.address().port

  console.log('Example app listening at http://%s:%s', host, port)

});

当我运行此命令时,节点ionic-gcm.js 我一直收到这个错误 错误:找不到模块正文解析器

===============================的package.json ============= =========

{
  "name": "ionic-gcm",
  "version": "1.0.0",
  "description": "ionic-gcm: An Ionic project",
  "dependencies": {
    "express": "^4.13.3",
    "gulp": "^3.5.6",
    "gulp-concat": "^2.2.0",
    "gulp-minify-css": "^0.3.0",
    "gulp-rename": "^1.2.0",
    "gulp-sass": "^1.3.3",
    "node-gcm": "^0.11.0",
    "server": "0.0.3"
  },
  "devDependencies": {
    "bower": "^1.3.3",
    "gulp-util": "^2.2.14",
    "shelljs": "^0.3.0"
  },
  "cordovaPlugins": [
    "org.apache.cordova.device",
    "org.apache.cordova.console",
    "com.ionic.keyboard",
    "cordova-plugin-whitelist"
  ],
  "cordovaPlatforms": [
    "android"
  ]
}

1 个答案:

答案 0 :(得分:5)

你遗失了body-parser。只需输入

npm install --save body-parser