Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

"Object.keys called on non-object" error node -v 0.12.4 win32 #30

Closed
jonovate opened this issue Jun 15, 2015 · 2 comments · Fixed by #34
Closed

"Object.keys called on non-object" error node -v 0.12.4 win32 #30

jonovate opened this issue Jun 15, 2015 · 2 comments · Fixed by #34

Comments

@jonovate
Copy link

Getting this on on package.json now, including dependency-check/package.json.

Object.keys(deps).forEach(function (dep) {
^
TypeError: Object.keys called on non-object
at Function.keys (native)
at c:\Users\Jonathon J. Howey\AppData\Roaming\npm\node_modules\dependency-ch
eck\index.js:101:14
at Array.forEach (native)
at c:\Users\Jonathon J. Howey\AppData\Roaming\npm\node_modules\dependency-ch
eck\index.js:100:13

@jonovate jonovate changed the title "Object.keys called on non-object" error node -v 0.12.4 "Object.keys called on non-object" error node -v 0.12.4 win32 Jun 15, 2015
@jonovate
Copy link
Author

So the call to getDeps() is callingback with NULL immediately because file is being passed in as an absolute path:
"c:\Users\Jonathon J. Howey\AppData\Roaming\npm\node_modules\dependency-ch eck\index.js"
This appears to be on purpose though because of path.join on lines 65 and 70 is resulting in paths[] array entries being absolute.

IS_NOT_RELATIVE.test(file) <== returns true.

So the easy workaround is comment it out locally, but I still don't understand the IS_NOT_RELATIVE vs lines 65 and 70. They seem to be conflicting.???

Is it a double NOT(NOT(..)) type of issue?

@voxpelli
Copy link
Member

From the description of the issues it sounds like it would be possible to solve this by replacing the regexp with a module that supports checking Windows paths as well – like: https://github.com/jonschlinkert/is-relative The current one wont detect Windows paths properly.

Would have trouble testing it though as I don't have good access to a Windows machine.

@jonovate If you could try and replace it and test it and make a PR then that would be helpful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants