编辑:image.js文件包含以下代码:
var imageStore = new FS.Store.FileSystem("images", {
path: "~/uploads"
});
Images = new FS.Collection("images", {
stores: [imageStore]
});
我尝试将应用程序部署到kirstenszoo.adopt.meteor.com。它已经整个时间都没有了,而且我知道应用程序存在一些错误(虽然它实际部署时没有说什么)。我尝试将另一个应用程序部署到同一个URL,它运行正常。下面的日志是我在使用命令“meteor log kirstenszoo.adopt.meteor.com”时得到的。有人可以向我解释这个日志的内容吗?
[Tue Aug 19 2014 05:05:16 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 05:05:16 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Tue Aug 19 2014 05:05:16 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 05:19:45 GMT+0000 (UTC)] NOTICE Starting application on port 30293
[Tue Aug 19 2014 05:19:45 GMT+0000 (UTC)] INFO STATUS waiting -> starting
[Tue Aug 19 2014 05:19:45 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 05:19:47 GMT+0000 (UTC)] WARNING throw(ex);
^
[Tue Aug 19 2014 05:19:47 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
[Tue Aug 19 2014 05:19:47 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 05:19:47 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 05:19:47 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Tue Aug 19 2014 05:44:13 GMT+0000 (UTC)] INFO STATUS waiting -> starting
[Tue Aug 19 2014 05:44:13 GMT+0000 (UTC)] NOTICE Starting application on port 30293
[Tue Aug 19 2014 05:44:13 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 05:44:14 GMT+0000 (UTC)] WARNING throw(ex);
[Tue Aug 19 2014 05:44:14 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
[Tue Aug 19 2014 05:44:14 GMT+0000 (UTC)] WARNING ^
[Tue Aug 19 2014 05:44:14 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 05:44:14 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Tue Aug 19 2014 05:44:14 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 05:55:10 GMT+0000 (UTC)] INFO STATUS waiting -> killed
[Tue Aug 19 2014 05:55:10 GMT+0000 (UTC)] INFO STATUS killed -> sleeping
[Tue Aug 19 2014 07:58:33 GMT+0000 (UTC)] INFO HIT / 218.102.217.67
[Tue Aug 19 2014 07:58:34 GMT+0000 (UTC)] INFO STATUS null -> starting
[Tue Aug 19 2014 07:58:34 GMT+0000 (UTC)] NOTICE Starting application on port 14200
[Tue Aug 19 2014 07:58:34 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 07:58:35 GMT+0000 (UTC)] WARNING throw(ex);
^
[Tue Aug 19 2014 07:58:35 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
[Tue Aug 19 2014 07:58:35 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 07:58:35 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 07:58:35 GMT+0000 (UTC)] NOTICE Starting application on port 14200
[Tue Aug 19 2014 07:58:35 GMT+0000 (UTC)] INFO STATUS running -> starting
[Tue Aug 19 2014 07:58:35 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 07:58:37 GMT+0000 (UTC)] INFO HIT / 218.102.217.67
[Tue Aug 19 2014 07:58:37 GMT+0000 (UTC)] INFO HIT /favicon.ico 218.102.217.67
[Tue Aug 19 2014 07:58:38 GMT+0000 (UTC)] INFO HIT /favicon.ico 218.102.217.67
[Tue Aug 19 2014 07:58:38 GMT+0000 (UTC)] INFO HIT /favicon.ico 218.102.217.67
[Tue Aug 19 2014 07:58:41 GMT+0000 (UTC)] WARNING throw(ex);
^
[Tue Aug 19 2014 07:58:41 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
[Tue Aug 19 2014 07:58:41 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 07:58:41 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 07:58:41 GMT+0000 (UTC)] NOTICE Starting application on port 14200
[Tue Aug 19 2014 07:58:41 GMT+0000 (UTC)] INFO STATUS running -> starting
[Tue Aug 19 2014 07:58:42 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 07:58:43 GMT+0000 (UTC)] WARNING throw(ex);
^
[Tue Aug 19 2014 07:58:43 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
[Tue Aug 19 2014 07:58:43 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 07:58:43 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 07:58:43 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Tue Aug 19 2014 07:58:56 GMT+0000 (UTC)] NOTICE Starting application on port 14200
[Tue Aug 19 2014 07:58:56 GMT+0000 (UTC)] INFO STATUS waiting -> starting
[Tue Aug 19 2014 07:58:56 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 07:58:57 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
throw(ex);
^
[Tue Aug 19 2014 07:58:57 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 07:58:57 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Tue Aug 19 2014 07:58:57 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 07:59:18 GMT+0000 (UTC)] INFO STATUS waiting -> starting
[Tue Aug 19 2014 07:59:18 GMT+0000 (UTC)] NOTICE Starting application on port 14200
[Tue Aug 19 2014 07:59:18 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 07:59:20 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
throw(ex);
^
[Tue Aug 19 2014 07:59:20 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 07:59:20 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Tue Aug 19 2014 07:59:20 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 08:00:20 GMT+0000 (UTC)] NOTICE Starting application on port 14200
[Tue Aug 19 2014 08:00:20 GMT+0000 (UTC)] INFO STATUS waiting -> starting
[Tue Aug 19 2014 08:00:20 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 08:00:22 GMT+0000 (UTC)] WARNING throw(ex);
[Tue Aug 19 2014 08:00:22 GMT+0000 (UTC)] WARNING ^
[Tue Aug 19 2014 08:00:22 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
[Tue Aug 19 2014 08:00:22 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 08:00:22 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 08:00:22 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Tue Aug 19 2014 08:02:44 GMT+0000 (UTC)] INFO STATUS waiting -> starting
[Tue Aug 19 2014 08:02:44 GMT+0000 (UTC)] NOTICE Starting application on port 14200
[Tue Aug 19 2014 08:02:44 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 08:02:45 GMT+0000 (UTC)] WARNING throw(ex);
^
[Tue Aug 19 2014 08:02:45 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
[Tue Aug 19 2014 08:02:45 GMT+0000 (UTC)] WARNING Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 08:02:45 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Tue Aug 19 2014 08:02:45 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 08:06:55 GMT+0000 (UTC)] NOTICE Starting application on port 14200
[Tue Aug 19 2014 08:06:55 GMT+0000 (UTC)] INFO STATUS waiting -> starting
[Tue Aug 19 2014 08:06:56 GMT+0000 (UTC)] INFO STATUS starting -> running
[Tue Aug 19 2014 08:06:57 GMT+0000 (UTC)] WARNING /meteor/dev_bundles/0.3.38/lib/node_modules/fibers/future.js:173
throw(ex);
^
Error: FS.Store.FileSystem unable to resolve "~" in path
at new FS.Store.FileSystem (packages/cfs-filesystem/filesystem.server.js:29)
at app/collection/images.js:1:53
at app/collection/images.js:9:3
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:161:10
at Array.forEach (native)
at Function._.each._.forEach (/meteor/dev_bundles/0.3.38/lib/node_modules/underscore/underscore.js:79:11)
at /meteor/containers/a8817e39-6de4-7b34-0b31-8bdbe4e22e09/bundle/programs/server/boot.js:82:5
[Tue Aug 19 2014 08:06:57 GMT+0000 (UTC)] INFO STATUS running -> waiting
[Tue Aug 19 2014 08:06:57 GMT+0000 (UTC)] ERROR Application crashed with code: 8
[Tue Aug 19 2014 08:07:13 GMT+0000 (UTC)] INFO HIT / 218.102.217.67
[Tue Aug 19 2014 08:07:14 GMT+0000 (UTC)] INFO HIT /favicon.ico 218.102.217.67
[Tue Aug 19 2014 08:07:14 GMT+0000 (UTC)] INFO HIT /favicon.ico 218.102.217.67
[Tue Aug 19 2014 08:07:15 GMT+0000 (UTC)] INFO HIT /favicon.ico 218.102.217.67
答案 0 :(得分:2)
您似乎正在使用collectionfs的本地文件系统存储。问题是,部署到meteor.com的应用程序没有访问/可用性来写入这样的路径。我遇到了完全相同的问题。我的解决方案是简单地注释掉或删除路径,为了简单起见,我还将结合你的两个声明。对于已部署的应用程序:
Images = new FS.Collection("images", {
stores: [new FS.Store.FileSystem("images")]
});
在本地运行时使用:
Images = new FS.Collection("images", {
stores: [new FS.Store.FileSystem("images", {path: "~/uploads"})]
});
答案 1 :(得分:0)
错误表示它无法理解您提供的路径中的~
。就我所知,tilde的实现是特定于服务器的,如果你的路径被附加到其他任何东西上几乎肯定不会工作(因此代字号不是第一个)。无论原因是什么,你都不能在这里使用波浪号。
基本上,您需要以不同的方式表达路径。您是否尝试过使用path: "/uploads"
并查看是否有效?
答案 2 :(得分:0)
如果您在本地计算机和免费测试meteor.com服务器上更改path: "./uploads"
的路径,它将起作用。但是,您需要确保您的组件未使用~/uploads
进行硬编码。
您也可以尝试FS.Store.GridFS
将图像存储在Mongo DB中,请查看链接:
https://medium.com/@victorleungtw/how-to-upload-files-with-meteor-js-7b8e811510fa
注意使用GridFS可能会有一些缺点,例如Mongo恢复过程的时间较长。