风帆初始化错误
问题描述:
我正在构建一个风帆应用程序,并突然停止工作。我跑sudo node app.js
启动应用程序和一个错误扔在终端上:风帆初始化错误
A hook (`userconfig`) failed to load!
error: Error: Invalid module: [object Object],(...)
我试着重新安装所有的模块,但对没有运气。 我收集了一些问题,如here和here,但它不是我正在寻找的。我会在这里提供我的package.json文件,万一有人需要阅读它:
{
"name": "myapp",
"private": true,
"version": "0.0.1",
"description": "my app description",
"keywords": [],
"dependencies": {
"bcrypt": "~0.7.6",
"ejs": "~0.8.4",
"grunt": "0.4.2",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-jst": "~0.6.0",
"grunt-contrib-less": "0.11.1",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-sails-linker": "~0.9.5",
"grunt-sync": "~0.0.4",
"include-all": "~0.1.3",
"mqtt": "^1.0.8",
"node-uuid": "^1.4.2",
"passport": "^0.2.1",
"passport-local": "^1.0.0",
"rc": "~0.5.0",
"sails": "~0.10.5",
"sails-disk": "~0.10.0",
"sails-mysql": "^0.10.11"
},
"scripts": {
"start": "node app.js",
"debug": "node debug app.js"
},
"main": "app.js",
"repository": {
"type": "git",
"url": "my repo"
},
"author": "Me",
"license": ""
}
任何帮助将是真棒......我所提供的信息,我认为这是必要的,但我会提供更多的,如果需要。
编辑: 我见过更多的问题here但没有工作太多。
答
由于某种原因,您的应用程序无法加载配置文件。您可能在某个配置中出现语法错误,配置数据冲突或在.sailsrc中更改配置路径。
你不应该在config目录中有.json文件。它看起来像帆载入每个文件,并尝试将其识别为配置模块
+0
再一次,谢谢!顺便说一下,我的.json文件的最佳位置是什么?我已经设置了两个文件来提供我的应用程序的一些基本配置,因为它是一些不必更改的静态数据。 – 2015-02-06 18:08:27
只是一个建议:不要使用sudo运行node.js应用程序。如果你想使用80端口,最好使用代理(如nginx或其他) – 2015-02-06 17:20:03
Hi @GlenSwift。我使用sudo运行,因为我的应用程序使用的是端口443(我正在使用https进行自签名证书的测试)。但我会听从你的建议。谢谢! – 2015-02-06 17:22:36
关于你的问题:听起来你的配置文件中有语法错误,或者修改.sailsrc中的配置路径。请检查这个。 – 2015-02-06 17:25:38