我的顶级meteorroot / lib目录中有以下代码:
// LIB /集合/ collectionsEnum.js
var collections = {};
COLLECTION_NAMES = Object.freeze({
EmployeesCollection:{
name:'EmployeesCollection',
value: getMeteorCollectionByName(name)
},
FoodCollection:{
name:'FoodCollection',
value: getMeteorCollectionByName(name)
},
PlayerCollection:{
name:'PlayerCollection',
value: getMeteorCollectionByName(name)
}
});
getMeteorCollectionByName = function(name){
for(var coll in COLLECTION_NAMES){
if(coll.name == name){
if(collections.name === undefined){
if(Meteor.isServer){
collections.name = new Meteor.Collection(name);
}
}
return collections.name;
}
}
return null;
}
运行> meteor
时出现此错误➜ oresoftware_meteor git:(master) ✗ meteor
[[[[[ ~/code/oresoftware_meteor ]]]]]
=> Started proxy.
/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:206
throw(ex);
Error: EACCES, readdir '/home/nitrous/code/oresoftware_meteor/lib/collections'
at Object.Future.wait (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:326:15)
at Object.wrapper (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/files.js:1124:24)
at readDirectory (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/watch.js:229:26)
at Object.readAndWatchDirectory (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/watch.js:650:18)
at readAndWatchDirectory (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/package-source.js:1551:32)
at [object Object].sourceArch.getSourcesFunc (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/package-source.js:1621:47)
at compileUnibuild (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/compiler.js:291:37)
at /home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/compiler.js:135:26
at Array.forEach (native)
at Function._.each._.forEach (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
at Object.compiler.compile (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/compiler.js:131:5)
at /home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/bundler.js:2023:24
at /home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:264:13
at [object Object]._.extend.withValue (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:115:14)
at /home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:257:29
at [object Object]._.extend.withValue (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:115:14)
at /home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:255:18
at [object Object]._.extend.withValue (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:115:14)
at /home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:246:23
at [object Object]._.extend.withValue (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:115:14)
at Object.capture (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:245:19)
at Object.exports.bundle (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/bundler.js:1975:31)
at bundleApp (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/run-app.js:508:34)
at [object Object]._.extend._runOnce (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/run-app.js:544:35)
at [object Object]._.extend._fiber (/home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/run-app.js:771:28)
at /home/nitrous/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/run-app.js:366:12
- - - - -
Object.freeze()调用和isMeteor()调用似乎不会导致问题。我做了isMeteor电话,因为我不相信你应该从客户端调用新的Meteor.Collection(),但是我必须三重检查。
答案 0 :(得分:1)
EACCES
错误表示您无权执行当前文件操作。这通常发生在以root身份运行或修改项目中的内容之后。尝试:
$ sudo chown $USER:$USER [filename]
在您的情况下,这看起来像:
$ sudo chown $USER:$USER /home/nitrous/code/oresoftware_meteor/lib/collections
如果您收到更多EACCES
错误,则可能需要chown
整个目录:
$ cd /home/nitrous/code/oresoftware_meteor
$ sudo chown -R $USER:$USER .