keeganstreet / element-finder

Find in Files with CSS selectors
http://keegan.st/2012/06/03/find-in-files-with-css-selectors/
118 stars 8 forks source link

TypeError in jsdom.js #1

Closed shapeshifta78 closed 11 years ago

shapeshifta78 commented 12 years ago

Hey there,

just tried you nifty little project but got an error in the knee...

/xxx/htdocs/node_modules/jsdom/lib/jsdom.js:250
    window.document.documentElement.appendChild(script);
                                    ^
TypeError: Cannot call method 'appendChild' of null
at exports.env.exports.jsdom.env.processHTML (/xxx/htdocs/node_modules/jsdom/lib/jsdom.js:250:41)
at Array.forEach (native)
at exports.env.exports.jsdom.env.processHTML (/xxx/htdocs/node_modules/jsdom/lib/jsdom.js:233:18)
at Object.exports.env.exports.jsdom.env (/xxx/htdocs/node_modules/jsdom/lib/jsdom.js:262:5)
at processFile (/xxx/htdocs/node_modules/element-finder/element-finder.js:141:10)
at walk.extension (/xxx/htdocs/node_modules/element-finder/element-finder.js:172:5)
at /xxx/htdocs/node_modules/element-finder/element-finder.js:92:10
at /xxx/htdocs/node_modules/element-finder/element-finder.js:92:10
at /xxx/htdocs/node_modules/element-finder/element-finder.js:92:10
at /xxx/htdocs/node_modules/element-finder/element-finder.js:92:10
keeganstreet commented 12 years ago

Oh no, we can't have errors in the knee! Could you please CD into the element-finder directory and run node -v and npm ls, to see which version of node and which versions of each required module you have?

Also, if its not private, could you send the HTML file that you searched with and the selector that you were searching for?

shapeshifta78 commented 12 years ago

I'm afraid, I can't send you my files, but they are just plain html and the selector is sth. like .wrapper. The node version is 0.8.0 and npm is version 1.1.32

There seems to be an error, because npm ls tells me:

npm WARN unmet dependency element-finder * in /home/XXX
 /home/XXX
├── commander@0.5.2
├── UNMET DEPENDENCY element-finder *

Am I doing sth. wrong? I installed all the modules from your readme via npm btw.

keeganstreet commented 12 years ago

I'm not sure what that means. It seems to be saying that "element-finder" is an unmet dependency, but element finder isn't an npm module, so that doesn't make sense.

keeganstreet commented 12 years ago

P.S. Here are my results for npm ls:

├── commander@0.5.2 
├─┬ jsdom@0.2.14 
│ ├─┬ contextify@0.1.3 
│ │ └── bindings@1.0.0 
│ ├── cssom@0.2.4 
│ ├── htmlparser@1.7.6 
│ └── request@2.9.203 
└── progress@0.0.4 

Maybe you're missing jsdom?

tonymilne commented 12 years ago

It looks like you have installed element-finder differently to the way Keegan intended; from what i understand, element-finder is a standalone app that can be used to find in files (rather than a module that you can embed into your own app), so it shouldn't exist inside a node_modules directory. E.g. "/xxx/htdocs/node_modules/element-finder" is not quite right.

Secondly, the npm output is indicating a warning only (presumably because your package.json and node_modules are out of sync) due to the above mis-placement of the element-finder. You can probably just run "npm prune" to resolve this (and maybe "npm update" afterwards if need be).

shapeshifta78 commented 12 years ago

Installed element-finder into home directory. Went into my project and installed the node modules which went into the node_modules directory via npm. Project directory is a vhost with sth. like /projectname/htdocs/ where I tried elfinder -s ".wrapper"

When I run elfinder now I get:

module.js:340
throw err;
      ^
Error: Cannot find module 'jsdom'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at /home/developer/element-finder/element-finder.js:8:11
at Object.<anonymous> (/home/developer/element-finder/element-finder.js:182:2)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
shapeshifta78 commented 11 years ago

I don't know how, but the problem is fixed now after reinstalling. Taking your nifty tool for a little spin :3

keeganstreet commented 11 years ago

Good to hear!