Uncaught ReferenceError: angular is not defined - Mean.IO

ⅰ亾dé卋堺 提交于 2019-12-06 17:29:09

问题


I have followed the steps to install mean.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:

Uncaught ReferenceError: angular is not defined

my issue is something similar to this, but I re-installed bower and it didn't work I'm still getting the error.

I'm trying to install this in 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?


回答1:


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:

{
"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

This will install to "Angular" in the project




回答2:


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.

However the answer form this stackoverflow thread worked -> bower command not found Basically the author there said I wasn't setting npm prefix properly and to fix that the following was required:

$ npm config set prefix /usr/local
$ npm install -g bower



回答3:


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"




回答4:


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

 {
  "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


来源:https://stackoverflow.com/questions/23398485/uncaught-referenceerror-angular-is-not-defined-mean-io

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!