This blog post supports the sample code for the “Angular 2: Getting Started” course on Pluralsight, identifying common issues along with their solutions. This course was updated on October 18, 2016 for the final release of Angular 2.
The sample code can be found here: https://github.com/DeborahK/Angular2-GettingStarted. The folders in this repo include:
- APM – Start: The starter files. Use this as a starting point to code along with the course.
- APM – Final: The completed files, updated to Angular 2 Beta 15. This code matches with the demos presented in the course.
Please post to the Discussion tab for the course if you experience an issue not found in this post. Thanks!
Problem: Error when using `npm install`.
There are several possible solutions depending on the source of your problem.
Solution 1: Ensure you have a current version of npm installed. The course was tested with node v6.5.0 and npm 3.10.6. If your version is significantly older, it may not work. Use node –v and npm –v to check your versions. To install a newer version of both tools, use this link: https://nodejs.org/en/download/current/
Solution 2: It may be a permissions problem. Try the steps found here: https://docs.npmjs.com/getting-started/fixing-npm-permissions
Setting Up Behind a Corporate Web Proxy
Problem: Error in installing typings when performing `npm install`. Error may be something like “Failed at the firstname.lastname@example.org postinstall: ‘typings install’
Solution 1: npm may not be using your globally defined proxy setting. Try adding a .typingsrc file with the value: "proxy=http://myproxy.com:myport"
Solution 2: Try manually installing the typings by running the following command at the command prompt: `npm run typings install`
See these posts for more information:
NOTE: If the proxy requires authentication (which is usually true), please use this format
NOTE: If you do not have access to the proxy URL and port, you can install the missing typing manually following the steps posted by Joe Ballard in the comments for this post below. Note however that with Angular 2 final you need core-js and node NOT es6-shim. See the typings.json file for details.
Twitter Bootstrap Does Not Work Properly
Problem: If you add component features to the sample application using Twitter Bootstrap, they may not work properly. For example, if you add the Twitter Bootstrap styles to display a dropdown menu, the menu does not drop down.
1. Modify the package.json file to include: "jquery": "2.2.3" (or whichever version you require)
2. Use the following command to update the packages: npm update
3. Include the following in index.html:
<!– Support Bootstrap Components –>
[[As provided by Scott Simpson]]