无法启动 Sails.JS 服务器

Adi*_*dis 3 node.js sails.js

我刚刚使用安装了一个新的 Sails.JS sails new sails。我已经安装了所有依赖项,并且 node_modules 文件夹可用。但是当我尝试使用运行服务器时sails lift,它给了我错误:

\n\n
error:\nerror: Error:\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\nNo `sails.config.sockets.onlyAllowOrigins` or `sails.config.sockets.beforeConnect`\nsetting was detected.  For security reasons, one of these options must be set\nwhen running Sails in a production environment.\nFor example (in config/env/production.js):\n\nsockets: {\n  onlyAllowOrigins: ["http://www.mydeployedapp.com", "http://mydeployedapp.com"]\n}\n\n\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n\n    at Hook.configure (A:\\Projects\\sails\\node_modules\\sails-hook-sockets\\lib\\configure.js:60:13)\n    at Hook.wrapper [as configure] (A:\\Projects\\sails\\node_modules\\@sailshq\\lodash\\lib\\index.js:3275:19)\n    at A:\\Projects\\sails\\node_modules\\sails\\lib\\app\\private\\loadHooks.js:331:20\n    at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:3083:16\n    at eachOfArrayLike (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:1003:9)\n    at eachOf (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:1051:5)\n    at Object.eachLimit (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:3145:5)\n    at configure (A:\\Projects\\sails\\node_modules\\sails\\lib\\app\\private\\loadHooks.js:328:17)\n    at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:3853:24\n    at replenish (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:946:17)\n    at iterateeCallback (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:931:17)\n    at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:906:16\n    at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:3858:13\n    at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:421:16\n    at iteratorCallback (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:998:13)\n    at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:906:16\n    at _combinedTickCallback (internal/process/next_tick.js:131:7)\n    at process._tickDomainCallback (internal/process/next_tick.js:218:9)\n    at Function.Module.runMain (module.js:695:11)\n    at startup (bootstrap_node.js:191:16)\n    at bootstrap_node.js:612:3\n\nerror: Could not load Sails app.\nerror:\nerror: Tips:\nerror:  \xe2\x80\xa2 First, take a look at the error message above.\nerror:  \xe2\x80\xa2 Make sure you\'ve installed dependencies with `npm install`.\nerror:  \xe2\x80\xa2 Check that this app was built for a compatible version of Sails.\nerror:  \xe2\x80\xa2 Have a question or need help?  (http://sailsjs.com/support)\n
Run Code Online (Sandbox Code Playgroud)\n\n

请帮我。

\n

sel*_*t91 5

如果您没有在应用程序中使用套接字,则打开项目根文件夹中存在的 .sailsrc 文件并在其中添加 hooks 对象

{
    "generators": {
         "modules": {}
    },
    "hooks" : {
          "sockets" : false
    },
    "_generatedWith": {
           "sails": "1.0.2",
           "sails-generate": "1.15.28"
    }
}
Run Code Online (Sandbox Code Playgroud)