Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDrew Templeton
6,509 PointsUsing NPM & Including Files
I am messing around with Yeoman for generating an Angular app. I am also new to npm in general but it seems to be fairly straight forward (or so I thought)
I am installed an oauth package using
npm install oauth
and this placed the files in my node_modules file.
My problem is when I try to include these files in my app it's not referring to any of the files in my node_modules directory. I tried putting
var OAuth = require('oauth').OAuth
in my app's js file and it's saying oauth is undefined. How do I include an installed npm package in my app?
Any help would be appreciated.
1 Answer
Sean T. Unwin
28,690 PointsYou almost have it.
var OAuth = require('oauth');
var credentials = new oauth.OAuth(
/* Credentials go here */
);
Drew Templeton
6,509 PointsDrew Templeton
6,509 PointsSean T. Unwin - Is this exactly what I'd need something like RequireJS for?
Sean T. Unwin
28,690 PointsSean T. Unwin
28,690 PointsYou sure could - http://requirejs.org/docs/node.html