bitovi / documentjs

The sophisticated documentation engine
https://documentjs.com/
MIT License
598 stars 381 forks source link

Error: ENOENT, lstat '/Users/josephpea/src/trusktr+/documentjs/site/default/static' #95

Open trusktr opened 9 years ago

trusktr commented 9 years ago

I have a folder called trusktr+documentjs. From the error it seems like documentjs is adding a slash to it, so that folder doesn't exist?

trusktr commented 9 years ago

It's doing it with underscores too: Error: ENOENT, lstat '/Users/josephpea/src/trusktr_/documentjs/site/default/static'

trusktr commented 9 years ago

By the way, I've got documentjs npm linked, so that's why it's looking there, in the repo I cloned.

trusktr commented 9 years ago

Oh duh, it'd help to show you the full error:

/Users/josephpea/src/trusktr_documentjs/node_modules/q/q.js:126
                    throw e;
                          ^
Error: ENOENT, lstat '/Users/josephpea/src/trusktr_/documentjs/site/default/static'
trusktr commented 9 years ago

Is it q's falt?

trusktr commented 9 years ago

Even without any symbols trusktrdocumentjs results in

Error: ENOENT, lstat '/Users/josephpea/src/trusktr/documentjs/site/default/static'

xD

trusktr commented 9 years ago

just documentjs works, so I'll use that temporarily.

justinbmeyer commented 9 years ago

Can you explain what your setup looks like in more detail. I don't know what you mean by "I have a folder". What does that mean?

Sent from my iPhone

On Jan 21, 2015, at 10:09 PM, Joseph Orbegoso Pea notifications@github.com wrote:

I have a folder called trusktr+documentjs. From the error it seems like documentjs is adding a slash to it, so that folder doesn't exist?

— Reply to this email directly or view it on GitHub.

trusktr commented 9 years ago

So basically, to install documentjs, I cloned the repo from github, went into the repo folder, then ran npm link so that documentjs is installed right from the repo folder globally. Now, when running documentjs, I get that error.

DocumentJS is looking for /Users/josephpea/src/trusktr+/documentjs/site/default/static, but it can't find it. The actual folder exists, and it is located in a different place: /Users/josephpea/src/trusktr+documentjs/site/default/static

DocumentJS (or one of it's dependencies?) seems to be looking in the wrong place.

trusktr commented 9 years ago

For comparison:

/Users/josephpea/src/trusktr+/documentjs/site/default/static # wrong
/Users/josephpea/src/trusktr+documentjs/site/default/static # correct

documentjs (or a dep) is inserting that extra slash at runtime, so the file doesn't exist when it looks it up.

justinbmeyer commented 9 years ago

Ok, so you installed documentjs in a folder with a special character. I will check that out.

Why is that not in a node_modules folder?

justinbmeyer commented 9 years ago

ah, global install ... I haven't really tried that yet.

justinbmeyer commented 9 years ago

So this line is probably the problem:

https://github.com/bitovi/documentjs/blob/master/lib/fs_extras.js#L11

If you changed that to something like:

root = path.dirname(path.dirname(__dirname))

Let me know if that fixes it and I will get it into our version.

trusktr commented 9 years ago

That didn't work, but path.dirname(__dirname) does return the root of my local documentjs, /Users/josephpea/src/trusktr+documentjs, so the fix would be not to assume that the app folder is called documentjs in whatever other file that is happening in. Documentjs is appending /documentjs to the root no matter what it is, when in fact the root has to end with trusktr+documentjs. In whatever file that is, maybe you can just use the root without appending anything, and just use root = path.dirname(__dirname) in fsx.

justinbmeyer commented 9 years ago

This is happening in another file?

trusktr commented 9 years ago

Yep :+1: , the makdirs, copy, and exists functions are receiving paths containing documentjs, so the solution seems to be

// folder = "documentjs",
root = path.dirname(__dirname);

and make sure arguments to those functions don't contain documentjs.

justinbmeyer commented 9 years ago

Working on this now. Not sure how this got dropped. Thanks!

trusktr commented 9 years ago

:+1: