node.js 未捕获的 ReferenceError:角度未定义 - Mean.IO
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23398485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Uncaught ReferenceError: angular is not defined - Mean.IO
提问by Hyman.the.ripper
I have followed the steps to installmean.io, but when I browse the localhost:3000 I get a blank page and when I open the console I get a list of files pointing to the same error:
我已经按照步骤安装mean.io,但是当我浏览 localhost:3000 时,我得到一个空白页面,当我打开控制台时,我得到一个指向相同错误的文件列表:
Uncaught ReferenceError: angular is not defined
未捕获的 ReferenceError:角度未定义
my issue is something similar to this, but I re-installed bower and it didn't work I'm still getting the error.
我的问题与此类似,但我重新安装了 bower,但它不起作用我仍然收到错误消息。
I'm trying to install this in ubuntu 14.04
我正在尝试在 ubuntu 14.04 中安装它
this is the screen I get:
这是我得到的屏幕:


Do I need to perform some sort of modification to any script, file reference or configuration, any suggestions?
我是否需要对任何脚本、文件引用或配置进行某种修改,有什么建议吗?
回答by Christian Cruz
I had the same problem and I solved in this way:
我遇到了同样的问题,我以这种方式解决了:
You need to install or reinstall "bower"
您需要安装或重新安装“凉亭”
Check your bower.json file, it should look something like this:
检查您的 bower.json 文件,它应该如下所示:
{
"name": "mean",
"version": "0.3.0",
"dependencies": {
"angular": "latest",
"angular-resource": "latest",
"angular-cookies": "latest",
"angular-mocks": "latest",
"angular-route": "latest",
"bootstrap": "latest",
"angular-bootstrap": "0.10.0",
"angular-ui-router": "#master"
}
}
and then run the following command:
然后运行以下命令:
? sudo bower install --allow-root
? sudo bower install --allow-root
This will install to "Angular" in the project
这将安装到项目中的“Angular”
回答by Mukul Raina
I had the same problem but for some reason the top answer here (reinstalling bower and running sudo bower install --allow-root) didn't work for me.
我遇到了同样的问题,但由于某种原因,这里的最佳答案(重新安装 bower 和 running sudo bower install --allow-root)对我不起作用。
However the answer form this stackoverflow thread worked -> bower command not foundBasically the author there said I wasn't setting npm prefixproperly and to fix that the following was required:
然而,这个stackoverflow线程的答案是有效的->找不到bower命令基本上那里的作者说我没有npm prefix正确设置并修复需要以下内容:
$ npm config set prefix /usr/local
$ npm install -g bower
回答by Lior Kesos
note the it is bad form to install mean.io as root and as a result run bower or npm as root. We actually built processes into mean-clithat will disallow running as root. Running as root is the sure way to expose mean to more serious security issues and to "contaminating" you .npm and .bower caches with a mix of normal and root based permissions which is very frustrating for "newbies"
请注意,以 root 身份安装 mean.io 并因此以 root 身份运行 bower 或 npm 是不好的形式。我们实际上将进程构建到 mean-cli 中,这将禁止以 root 身份运行。以 root 身份运行是暴露更严重安全问题和“污染”你的 .npm 和 .bower 缓存的可靠方法,混合了基于普通和 root 的权限,这对“新手”来说非常令人沮丧
回答by reenu29
If you are behind the proxy, then still problem not solved. So in order to solve it you need to include proxy-setting in .bowerrc file as
如果你在代理后面,那么问题仍然没有解决。因此,为了解决它,您需要在 .bowerrc 文件中包含代理设置作为
{
"directory": "public/lib",
"proxy":"http://user:passwd@server:port",
"https-proxy":"http://user:passwd@server:port"
}
Now run
现在运行
sudo npm install -g bower
sudo bower install --allow-root

