stefanpenner / hash-for-dep

7 stars 11 forks source link

Crashes on Windows due to invalid path #26

Closed nmcclay closed 8 years ago

nmcclay commented 8 years ago

In pkg.js line 19: var thePackage = require(baseDir + '/package.json');

Causes:

Error: Cannot find module 'D:\Work\blah\node_modules\ember-cli\node_modules\broccoli-babel-transpiler\node_modules\babel-core\node_modules\babel-plugin-undeclared-variables-check\/package.json'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at pkg (D:\Work\blah\node_modules\hash-for-dep\lib\pkg.js:19:20)
    at again (D:\Work\blah\node_modules\hash-for-dep\lib\deps-for.js:18:22)
    at D:\Work\blah\node_modules\hash-for-dep\lib\deps-for.js:27:7
    at Array.forEach (native)
    at again (D:\Work\blah\node_modules\hash-for-dep\lib\deps-for.js:26:55)
    at D:\Work\blah\node_modules\hash-for-dep\lib\deps-for.js:27:7

How to fix:

var path = require('path');
var thePackage = require(path.join(baseDir, 'package.json'));
stefanpenner commented 8 years ago

@nmcclay what version of node?

nmcclay commented 8 years ago

5.11.0

stefanpenner commented 8 years ago

do you have a chance to add a failing test case/ pr. Im swamped at the moment.

nmcclay commented 8 years ago

So I spent the afternoon figuring out what was going on with a remote colleague. I'm not sure if this itself was the issue or not unfortunately. Ultimately we ended up doing npm clear cache and fully restarting the app and it cleared up the issue so we could move on. I won't hold it against you if you do the same here ;)

stefanpenner commented 8 years ago

Given that the test suite passes in windows https://ci.appveyor.com/project/embercli/hash-for-dep and a npm cache clear fixed the issue. I am unsure if action is needed here.

If this turns up again, or a failing test can be provided I will gladly dig in.