gpt4 book ai didi

javascript - 在我执行 git init 并创建一个新分支后,Meteor 崩溃了

转载 作者:行者123 更新时间:2023-12-03 11:08:36 24 4
gpt4 key购买 nike

我正在开发一个 Meteor 项目,这是我第一次使用 Meteor。

一切都工作正常,直到我决定对我正在工作的目录执行“git init”,然后执行“git checkout -b gh-pages”。这样我就可以在这里向 S.O. 发布一个存储库和一个现场演示。因为我有一个完全不同的问题。

在摆弄了过去很容易的事情(创建 gh-pages)之后,这个过程不再对我有用,不确定 GitHub 是否改变了他们创建页面的过程,但由于某种原因,它对我不起作用,即使在遵循之后这些说明:https://help.github.com/articles/creating-project-pages-manually/

创建另一个分支并尝试将代码推送到 gh-pages 后,我突然开始收到这些错误。

抱歉,这很长:

=> Started proxy.                             
=> Started MongoDB.
W20141230-20:19:22.649(-5)? (STDERR)
W20141230-20:19:22.735(-5)? (STDERR) /Users/MARS/.meteor/packages/meteor-tool/.1.0.38.z83ibe++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:173
W20141230-20:19:22.735(-5)? (STDERR) throw(ex);
W20141230-20:19:22.735(-5)? (STDERR) ^
W20141230-20:19:22.735(-5)? (STDERR) Error: A method named '/players/insert' is already defined
W20141230-20:19:22.736(-5)? (STDERR) at packages/ddp/livedata_server.js:1444:1
W20141230-20:19:22.736(-5)? (STDERR) at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
W20141230-20:19:22.736(-5)? (STDERR) at [object Object]._.extend.methods (packages/ddp/livedata_server.js:1442:1)
W20141230-20:19:22.736(-5)? (STDERR) at [object Object].Mongo.Collection._defineMutationMethods (packages/mongo/collection.js:886:1)
W20141230-20:19:22.736(-5)? (STDERR) at new Mongo.Collection (packages/mongo/collection.js:208:1)
W20141230-20:19:22.737(-5)? (STDERR) at app/leaderboard.js:1:50
W20141230-20:19:22.737(-5)? (STDERR) at app/leaderboard.js:80:3
W20141230-20:19:22.737(-5)? (STDERR) at /Users/MARS/Desktop/Sandbox/meteor/leaderboard/.meteor/local/build/programs/server/boot.js:175:10
W20141230-20:19:22.737(-5)? (STDERR) at Array.forEach (native)
W20141230-20:19:22.737(-5)? (STDERR) at Function._.each._.forEach (/Users/MARS/.meteor/packages/meteor-tool/.1.0.38.z83ibe++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
=> Exited with code: 8

它执行了三次此操作,然后以“=>您的应用程序正在崩溃。等待文件更改。”结束。

以前有人遇到过这种情况吗?或者有人可以解释为什么会发生这种情况吗?

这是我迄今为止唯一的代码:

PlayersList = new Mongo.Collection('players');

if(Meteor.isClient){
Template.leaderboard.helpers({
'player' : function(){
return PlayersList.find( {}, {sort: {score: -1, name: 1} });
},
'count' : function() {
return PlayersList.find().count();
},
'selectedClass' : function() {
var playerId = this._id;
var selectedPlayer = Session.get('selectedPlayer');
if(playerId === selectedPlayer) {
return "selected";
}
},
'showSelectedPlayer' : function() {
var selectedPlayer = Session.get('selectedPlayer');
return PlayersList.findOne(selectedPlayer);
}
});

Template.leaderboard.events({
'click .player' : function() {
var playerId = this._id;
Session.set('selectedPlayer', playerId);
},
'click .increment' : function() {
var selectedPlayer = Session.get('selectedPlayer');
PlayersList.update(selectedPlayer, {$inc: {score: 5} });
},
'click .decrement' : function() {
var selectedPlayer = Session.get('selectedPlayer');
PlayersList.update(selectedPlayer, {$inc: {score: -5} });
},
'click .remove' : function() {
var selectedPlayer = Session.get('selectedPlayer');
alert('Are you sure you want to delete this fool?');
PlayersList.remove(selectedPlayer);
}
});

Template.addPlayerForm.events({
'submit form' : function(event) {
event.preventDefault();

var playerNameVar = event.target.playerName.value;
var playerScoreVar = event.target.playerScore.value;

PlayersList.insert({
name: playerNameVar,
score: playerScoreVar
});

var formAddPlayer = document.getElementById('formAddPlayer');

formAddPlayer.reset();
}
});
}

if(Meteor.isServer){

}

谢谢。

最佳答案

我以前也遇到过这样的问题。为我解决这个问题的只是运行 git clean -dfx我真的没有看到您的代码有任何问题应该引发该错误。可能只是 git 很奇怪。

关于javascript - 在我执行 git init 并创建一个新分支后,Meteor 崩溃了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27715005/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com