layout.jade 中包括 Bower 安装在内的问题

Problems including bower installs in layout.jade

我对平均堆栈相当陌生,当我从 angular 从 cdn 导入到 layout.jade 中的 bower 切换时,我的应用程序停止工作。我正在尝试导入的所有来源都收到 "ReferenceError: angular is not defined" 和 404。

我的layout.jade是这样的(我也试过前面的../和../../,结果一样):

doctype html
html(ng-app='RIThym')
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
    script(src='bower_components/angular/angular.js')
    script(src='bower_components/angular-resource/angular-resource.js')
    script(src='bower_components/angular-route/angular-route.js')
    script(src='bower_components/angular-ui-map/ui-map.js')
    script(src='/javascripts/RIThym.js')
  body
    block content

这是我的项目结构:

bin

bower_components

node_modules

public

routes

views

layout.jade

app.js

package.js

我假设 public_html 是您的网络服务器的根目录。在这种情况下,服务器无权访问 bower_components 目录。并且不会 return 来自 bower_components 的任何东西。

要解决此问题,请将 bower_components 目录移动到 public_html。