I have the following dependency array in package.json:
"dependencies": {
"doT": "git://github.com/nick-jonas/doT.git#cbc7041b646a79cca1034820db09167407d2f988",
"lodash": "latest",
"commander": "latest",
"minimatch": "0.2.9",
"prompt": "latest",
"mkdirp": "latest",
"fs-extra": ">=0.3.2",
"shelljs": ">=0.1.0",
"cheerio": ">=0.10.5",
"readdirp": ">=0.2.1"
}
Note the first dep:
"doT": "git://github.com/nick-jonas/doT.git#cbc7041b646a79cca1034820db09167407d2f988"
This works with npm. When running npm install it will place the correct version of doT into my node_modules directory. It will however give this error message when Travis-CI runs the test script:
227 vows test/*.js --spec
228
229
230 module.js:340
231 throw err;
232 ^
233 Error: Cannot find module 'doT'
234 at Function.Module._resolveFilename (module.js:338:15)
235 at Function.Module._load (module.js:280:25)
236 at Module.require (module.js:362:17)
237 at require (module.js:378:17)
238 at Object.<anonymous> (/home/travis/builds/nick-jonas/assemblejs/lib/commands/writer.js:15:11)
239 at Module._compile (module.js:449:26)
240 at Object.Module._extensions..js (module.js:467:10)
241 at Module.load (module.js:356:32)
242 at Function.Module._load (module.js:312:12)
243 at Module.require (module.js:362:17)
244 npm ERR! Test failed. See above for more details.
245 npm ERR! not ok code 0
Running this command locally vows test/*.js --spec also works, so I'm assuming it's a problem with Travis-CI grabbing hashed-URL dependencies.
Anyone else have a problem similar to this?
Taking a peek at your TravisCI task that failed, it seems like it did actually successfully install doT@1.0.0:
https://travis-ci.org/nick-jonas/assemblejs/jobs/4115442/#L188
If I look at the dot.js project repository, it looks like the doT package.json file has the name listed as "dot" instead of "doT".
I'd try changing require('doT') to require('dot') in writer.js (or wherever else it's used).
It looks like this might be a case-sensitivity issue, which can be particularly annoying to deal with the npm world.
@smithclay is exactly right. You are probably working on a Mac which has a case insensitive file system. Linux however, which travis is running on, does not.
I ran into a similar issue recently and created valiquire to check that all require statements point to valid locations, including correct casing.
That way I can troubleshoot them locally. It also is useful to include a valiquire check as part of your tests in order to avoid breaking the build.