使用快递4.12.3和科尔多瓦5.0.0,并jxcore-cordova plugin:JXcore_cordova插件机器人的NodeJS问题
写的代码这个简单的段不起作用:
var http = require('http');
var express = require('express');
var app = express();
var server = http.createServer(app);
server.listen(1337);
app.get('/',function(req,res){
res.sendFile(__dirname + '/public/index.html');
res.end();
});
返回错误是:
5611-5648 /输入com.example.hello E/jxcore日志:[email protected]/data/data/com.example.hello/files/node_modules/express/node_modules/etag/index.js:55:1 [email protected]/data/data/com.example.hello/files/node_modules/express/node_m odules/send/index.js:739:15 [email protected]/data/data/com.example.hello/files/node_modules/express/node_modules/send/index.js:507:3 onstat @/data /data/com.example.hello/files/node_modules/express/node_modules/send/index.js:600:5 makeCallback/< @ fs.js:83:12 [email protected]:718:7 [email protected]/data/data/com.example.hello/files/node_modules/express/node_modules/send/index.js:590:3 [email protected]/data/data/com.example.hello/files /node_modules/express/node_modules/send/index.js:479:3 [email protected]/data/data/com.example.hello/files/node_modules/express/lib/response.js:1029:3 sendFile @/data /data/com.example.hello/files/node_modules/express/lib/response.js:402:3 @/data/data/com.example.hello/files/app.js:2 4:5 [email protected]/data/data/com.example.hello/files/node_modules/express/lib/router/layer.js:82:5 [email protected]/data/data/com.example.hello/files/使用FS模块 :node_mod
然而,这个代码工作正常
fs.readFile(__dirname + '/public/index.html',function(err,html){
app.get('/',function(req,res){
res.write(html);
res.end();
});
});
测试在Android Studio和Eclipse在Linux薄荷和Windows 7的插件正常工作在iOS。