Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors occur when nodeRED is embedden in express? #816

Closed
tosone opened this issue Mar 4, 2016 · 4 comments
Closed

Errors occur when nodeRED is embedden in express? #816

tosone opened this issue Mar 4, 2016 · 4 comments

Comments

@tosone
Copy link

tosone commented Mar 4, 2016

Environment

  • node 4.3.2
  • npm 2.14.12
  • windows 10
  • visualstudio 2015
  • python 2.7.11

My app.js like this

'use strict';
const path = require('path');
const http = require('http');
const express = require('express');
const ejs = require('ejs');
const bodyParser = require('body-parser');
const favicon = require('serve-favicon');
const morgan = require('morgan');
const config = require('FCconfig.js');
const red = require("node-red");
const app = express();

app.use(morgan('dev'));
app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static(path.join(__dirname, 'public')));
app.set('views', path.join(__dirname, 'views'));
app.engine('.html', ejs.__express);
app.set('view engine', 'html');

app.use('/', require('./routes/index'));

let server = http.createServer(app);

let NodeRedSettings = {
    httpAdminRoot: "/red",
    httpNodeRoot: "/api",
    userDir: "/home/nol/.nodered/",
    functionGlobalContext: {}
};
red.init(server, NodeRedSettings);
app.use(NodeRedSettings.httpAdminRoot, red.httpAdmin);
app.use(NodeRedSettings.httpNodeRoot, red.httpNode);

server.listen(80, function() {
    console.log('Server runing at http://127.0.0.1:80.');
});

when i get the http://127.0.0.1/red
something wrong will be happened

TypeError: Cannot read property 'en-US' of undefined
    at Object.i18n.functions.extend.load (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\lib\i18nextWrapper.js:282:39)
    at init (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\node_modules\i18next-client\i18next.js:988:19)
    at Object.setLng (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\node_modules\i18next-client\i18next.js:1200:16)
    at module.exports.get (D:\code\coding\FCManager\node_modules\node-red\red\api\locales.js:57:16)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at next (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:131:13)
    at Route.dispatch (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at D:\code\coding\FCManager\node_modules\express\lib\router\index.js:277:22
    at param (D:\code\coding\FCManager\node_modules\express\lib\router\index.js:349:14)
GET /red/locales/editor 400 60.909 ms - 93
TypeError: Cannot read property 'en-US' of undefined
    at Object.i18n.functions.extend.load (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\lib\i18nextWrapper.js:282:39)
    at init (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\node_modules\i18next-client\i18next.js:988:19)
    at Object.setLng (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\node_modules\i18next-client\i18next.js:1200:16)
    at module.exports.get (D:\code\coding\FCManager\node_modules\node-red\red\api\locales.js:57:16)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at next (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:131:13)
    at Route.dispatch (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at D:\code\coding\FCManager\node_modules\express\lib\router\index.js:277:22
    at param (D:\code\coding\FCManager\node_modules\express\lib\router\index.js:349:14)
GET /red/locales/node-red 400 29.035 ms - 93
TypeError: Cannot read property 'en-US' of undefined
    at Object.i18n.functions.extend.load (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\lib\i18nextWrapper.js:282:39)
    at init (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\node_modules\i18next-client\i18next.js:988:19)
    at Object.setLng (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\node_modules\i18next-client\i18next.js:1200:16)
    at module.exports.get (D:\code\coding\FCManager\node_modules\node-red\red\api\locales.js:57:16)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at next (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:131:13)
    at Route.dispatch (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at D:\code\coding\FCManager\node_modules\express\lib\router\index.js:277:22
    at param (D:\code\coding\FCManager\node_modules\express\lib\router\index.js:349:14)
GET /red/locales/editor 400 58.495 ms - 93
TypeError: Cannot read property 'en-US' of undefined
    at Object.i18n.functions.extend.load (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\lib\i18nextWrapper.js:282:39)
    at init (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\node_modules\i18next-client\i18next.js:988:19)
    at Object.setLng (D:\code\coding\FCManager\node_modules\node-red\node_modules\i18next\node_modules\i18next-client\i18next.js:1200:16)
    at module.exports.get (D:\code\coding\FCManager\node_modules\node-red\red\api\locales.js:57:16)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at next (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:131:13)
    at Route.dispatch (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at D:\code\coding\FCManager\node_modules\express\lib\router\index.js:277:22
    at param (D:\code\coding\FCManager\node_modules\express\lib\router\index.js:349:14)
GET /red/locales/node-red 400 25.881 ms - 93
GET /red/settings?_=1457080110794 200 1.334 ms - 42
TypeError: Cannot read property 'hasOwnProperty' of undefined
    at Object.storageModuleInterface.getAllFlows (D:\code\coding\FCManager\node_modules\node-red\red\runtime\storage\index.js:117:30)
    at module.exports.getAll (D:\code\coding\FCManager\node_modules\node-red\red\api\library.js:80:17)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at next (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:131:13)
    at D:\code\coding\FCManager\node_modules\node-red\red\api\auth\index.js:63:13
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at next (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:131:13)
    at Route.dispatch (D:\code\coding\FCManager\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (D:\code\coding\FCManager\node_modules\express\lib\router\layer.js:95:5)
    at D:\code\coding\FCManager\node_modules\express\lib\router\index.js:277:22
@tosone tosone changed the title when it embeded into express,something goes wrong? Once the nodeRED is embedden in express, errors occur? Mar 4, 2016
@tosone tosone changed the title Once the nodeRED is embedden in express, errors occur? Errors occur when nodeRED was embedden in express? Mar 4, 2016
@tosone tosone changed the title Errors occur when nodeRED was embedden in express? Errors occur when nodeRED is embedden in express? Mar 4, 2016
@Cleanshooter
Copy link

could you share the contents of the package.json?

@tosone
Copy link
Author

tosone commented Mar 5, 2016

{
"name": "flowchartmanager",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.15.0",
"ejs": "^2.4.1",
"express": "^4.13.4",
"morgan": "^1.7.0",
"node-red": "^0.13.3",
"serve-favicon": "^2.3.0",
"uuid": "^2.0.1"
}
}
that is it

@kevinxusz
Copy link

������������������

------------------ �������� ------------------

    ������: Tosone  <notifications@github.com>;


    ��������: 2016-03-05 18:26:49


    ������: node-red/node-red  <node-red@noreply.github.com>; 


    ����: (��); 


    ����: Re: [node-red] Errors occur when  nodeRED is embedden in express?(#816)


 { "name": "flowchartmanager", "version": "1.0.0", "description": "", "main": "app.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "body-parser": "^1.15.0", "ejs": "^2.4.1", "express": "^4.13.4", "morgan": "^1.7.0", "node-red": "^0.13.3", "serve-favicon": "^2.3.0", "uuid": "^2.0.1" } } that is it �� Reply to this email directly or  view it on GitHub.

@knolleary
Copy link
Member

You have not called red.start(), so node-red isn't running.

Need to see what error handling/reporting we need to make this more obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants