本文介绍了意外的标记<而平均运行应用程序栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造平均堆栈应用以下Plurasight视频教程。

I am following Plurasight video tutorials on creating mean stack application.http://pluralsight.com/training/Courses/TableOfContents/building-angularjs-nodejs-apps-mean


一切工作正常,直到早上我发现的一个奇怪的问题意外令牌LT;

我改变力的code

scripts.jade

scripts.jade

script(type="text/javascript",src="/vendor/jquery/dist/jquery.js")
script(type="text/javascript",src="/vendor/angular/angular.js")
script(type="text/javascript",src="/vendor/angular-resource/angular-resource.js")
script(type="text/javascript",src="/vendor/angular-route/angular-route.js")
script(type="text/javascript",src="/app/app.js")
script(type="text/javascript",src="/app/main/mvMainCtrl.js")
script(type="text/javascript",src="/app/account/myNavBarLoginCtrl.js")

server.js

server.js

/**
 * Created by nyaconcepts on 4/10/2014.
 */
var express=require('express'),
    stylus=require('stylus'),
    bodyParser = require('body-parser'),
    morgan  = require('morgan'),
    mongoose = require('mongoose');

var env=process.env.NODE_ENV=process.env.NODE_ENV||'development';

var app=express();

function compile(str,path){
    return stylus(str).set('filename',path);
}
//Supported by older version
/*app.configure(function(){
    app.set('views',__dirname+'/server/views');
    app.set('view_engine','jade');
});*/

if ('development' == env) {
    app.set('views',__dirname+'/server/views');
    app.set('view engine','jade');
    app.use(morgan('dev'));
    app.use(bodyParser());
    app.use(stylus.middleware({
         src:__dirname+'/public',
         compile:compile
        }
    ));
    app.use(express.static(__dirname+'../public'));
  }

if(env=='development'){
    mongoose.connect('mongodb://localhost/multivision');
}
else {
    mongoose.connect('mongodb://kamlesh:[email protected]:53658/multivision');
}
var db=mongoose.connection;
db.on('error',console.error.bind(console,'Connection Error..!!'));
db.once('open',function callback(){
    console.log('multivision db opened');
});

/* For displaying partial message
var messageSchema = mongoose.Schema({message: String});
var Message = mongoose.model('Message', messageSchema);
var mongoMessage;
Message.findOne().exec(function(err, messageDoc) {
    mongoMessage = messageDoc.message;
});*/

app.get('/partials/*', function(req, res) {
    res.render('/../../public/app/' + req.params);
});

app.get('*',function(req,res){
    res.render('index');
        //mongoMessage : mongoMessage
});

var port=process.env.PORT||3030;
app.listen(port);

console.log('Listening on port'+port+'---');

请提出了一些解决方案。

Please suggest some solution

推荐答案

如果我猜,我敢打赌你的路由设置不正确,你就在所有这些JS文件加载HTML。

If I had to guess, I'd bet your routes aren't setup properly and you're loading HTML in all those JS files.

在开发工具,点击那些语法错误之一的右侧。

In dev tools, click the right side of one of those syntax errors.

如果jquery.js和不上来,你需要找出原因。一旦你得到了正确的资产负载,即的解决这个问题。

If jquery.js doesn't come up, you need to figure out why. Once you get the correct assets loading, that should solve the problem.

这篇关于意外的标记<而平均运行应用程序栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 18:28