ColumbiaJS / js-course

Columbia Computer Science Course in Advanced Javascript as Taught By Lev Brie
23 stars 4 forks source link

Cannot find module 'gulp-mocha' #8

Closed ghost closed 9 years ago

ghost commented 9 years ago

I wanted to make sure my JS test environment worked. When trying to run GULP in the HW2 directory, I get the error below. Has anybody experienced this when running GULP?

[19:09:30] Working directory changed to ~/Downloads/w3101hws-master/hw2 Error: Cannot find module 'gulp-mocha' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at /Users/cevasquez/Downloads/w3101hws-master/hw2/gulpfile.js:5:18 at Object. (/Users/cevasquez/Downloads/w3101hws-master/hw2/gulpfile.js:35:3) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12)

levbrie commented 9 years ago

@cev2107 Hey Chris, this is most likely caused by neglecting to have installed the dependencies for this project. Whenever you get a new repo for a node-based project, the dependencies needed for the project will be specified inside of the package.json file, but they won't be installed (these modules install into the node_modules/ directory by default and we've added this directory to the .gitignore file so that they won't be included in the repository, which takes up a lot of space unnecessarily). So every time you get a new project, you need to make sure to run $ npm install from inside that project's directory (in this case, inside of hw2/) in order to install the necessary dependencies. Please re-open if this turns out not to be the issue or you still have a question.

levbrie commented 9 years ago

Hey James,

This issue appears to be related to your code and not to gulp or mocha. AssertionError means that mocha is telling you that a test failed somewhere. This is exactly what should happen when you run gulp in this project, since the tests are testing for the functionality that you haven't yet implemented. You'll know you've completed the assignment when all of the tests are passing, but for a while, almost all of them will be failing (you can limit the tests that are run by going into a specific *.spec.js file and changing describe to describe.only. Does that make sense.

Also, if you can, please try to make sure to file any of these questions as issues or follow-ups to issues on Github (whenever you get an email from an issue there should be a link at the bottom to "view it on Github". That way, everyone can learn from/contribute to the issue and it's easier to provide you with formatted code using Github's markdown.

Best, Lev

On Tue, Feb 3, 2015 at 5:33 PM, James Lin notifications@github.com wrote:

Hmm... I'm still having a similar issue with gulp, specifically mocha. I tried uninstalling and reinstalling gulp (using "sudo npm install -g gulp" and "sudo npm install" in hw2), but the error persists. Here is the error that I'm getting:

[17:31:44] Starting 'mocha'... [17:31:44] { [AssertionError: expected 'object' to equal 'function'] message: 'expected \'object\' to equal \'function\'', showDiff: true, actual: 'object',........ [17:31:44] 'mocha' errored after 271 ms [17:31:44] AssertionError in plugin 'gulp-mocha' Message: expected 'object' to equal 'function' Details: showDiff: true

— Reply to this email directly or view it on GitHub https://github.com/ColumbiaJS/js-course/issues/8#issuecomment-72750403.