当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Require is not defined? Todd Motto Angular 1.5 starter tutorial

问题描述:

I am trying to start Todd motto's angular 1.5 tutorial but after adding all the dependencies and running npm install, running npm start gives me a require is not defined error in the browser? can anyone tell me what is wrong?

The seed project can be found here: https://github.com/toddmotto/ultimate-angular-master-seed

vendor.js:39766 Uncaught ReferenceError: require is not defined

vendor.js:4640 Uncaught Error: [$injector:modulerr] Failed to instantiate module root due to:

Error: [$injector:modulerr] Failed to instantiate module components due to:

Error: [$injector:modulerr] Failed to instantiate module components.auth due to:

Error: [$injector:modulerr] Failed to instantiate module firebase due to:

Error: [$injector:nomod] Module 'firebase' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

http://errors.angularjs.org/1.5.8/$injector/nomod?p0=firebase

网友答案:

as you can see Module 'firebase' is not available! so the fastest way to address this issue is to add this library:

Go to src folder and change this line

 <script src="js/vendor.js"></script>
 <script src="js/bundle.js"></script>

to

 <script src="https://cdn.firebase.com/js/client/2.2.2/firebase.js"></script>
  <script src="js/vendor.js"></script>
  <script src="js/bundle.js"></script>
  <script src="https://cdn.firebase.com/libs/angularfire/1.0.0/angularfire.min.js"></script>

I recommend you to contact him and ask for solution it just a quick tip for you to address your problem but may not be the best for now.

网友答案:

Issue has been fixed by Todd motto on the seed project. Looks like It was caused by a new version of fire base that added require syntax which broke the code.

分享给朋友:
您可能感兴趣的文章:
随机阅读: