为什么不能 shell 在服务器上用 Meteor 运行 编码?

Why can't shell code in Meteor run well on server?

我在我的 Mac 中很好地制作了我的流星应用程序 运行 shell 代码(如 mkdir foo),但是当我将它部署到我的 VPS 时,它不能 run.I 使用 Meteor 和 MUP 来部署 it.Now 我不知道如何在我的 VPS 上调试它。

DEMO代码来了:

if (Meteor.isServer) {
  Meteor.startup(function () {
    Meteor.methods({
      setBlogList: function(){
        var run = Npm.require('child_process');
        run.exec('mkdir ~/memeda');
    }
    });
  });
}

你是什么意思"it can't run"?如果有的话,您会收到什么错误消息?

如果代码无法创建目录,可能是因为运行它的用户 mup 没有写入它认为的主目录的权限。

使用 path.resolve('~/memeda') to see what that directory actually resolves to in the filesystem, and go from there. Look in the mup documentation 了解如何设置路径(例如 app 设置)。