【问题标题】:Sails server not startedSails 服务器未启动
【发布时间】:2015-12-30 10:19:54
【问题描述】:

我正在尝试使用以下命令运行我的应用程序:

forever start /var/www/app.js --prod

但我有这个错误:

To run an app using `node app.js`, you usually need to have a version of `sails` installed in the same directory as your app.
To do that, run `npm install sails`

Alternatively, if you have sails installed globally (i.e. you did `npm install -g sails`), you can use `sails lift`.
When you run `sails lift`, your app will still use a local `./node_modules/sails` dependency if it exists,
but if it doesn't, the app will run with the global sails instead!

Sails 已安装在同一目录中。 Forever 是全局安装的。

我也测试了

node app.js --prod

但同样的错误,所以它不是因为永远。

我在节点 V4.1.1 和 npm v3.3.4 下。 sails lift 工作得很好。

【问题讨论】:

  • 您是否尝试按照错误消息的提示执行操作?
  • 是的 :) 也尝试删除 node-modules/sails 并再次 npm install 但没有运气...
  • 你试过运行$ npm install,然后运行,$ forever start app.js吗?

标签: node.js sails.js forever


【解决方案1】:

您是否尝试过全局安装 Sails ?

【讨论】:

  • 谢谢!我在全球范围内尝试航行(或不尝试)。我发现问题看我的回答
【解决方案2】:
cd /var/www
forever start app.js --prod

请试试这个方法,看看它是否有效。

【讨论】:

  • 谢谢!是的,我试过了。终于找到问题看我的回答了
【解决方案3】:

终于搞定了! 一些sails依赖没有正确安装,我已经删除了我项目的所有node_modules文件夹和npm install,现在它可以工作了。

错误信息不正确。

【讨论】:

    【解决方案4】:

    尝试检查应用程序中的 .sailsrc 文件 我的逗号被遗漏了

    "generators": {
        "modules": {},
    }
    

    删除逗号对我有用

    【讨论】: