Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

Handle errors #148

Closed
wesleytodd opened this issue Mar 31, 2015 · 49 comments
Closed

Handle errors #148

wesleytodd opened this issue Mar 31, 2015 · 49 comments
Labels

Comments

@wesleytodd
Copy link
Owner

See: #147

There are a bunch of places we can add useful error messages.

@wesleytodd wesleytodd added the bug label Mar 31, 2015
@jacquesletesson
Copy link

            remote.directory('.', this.conf.get('wpDir'));
                  ^
TypeError: Cannot read property 'directory' of undefined
    at Generator.<anonymous> (/usr/local/lib/node_modules/generator-wordpress/app/index.js:216:10)
    at Generator.<anonymous> (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/lib/actions/remote.js:79:21)
    at Stream.<anonymous> (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/lib/actions/fetch.js:70:21)
    at Stream.emit (events.js:129:20)
    at DestroyableTransform.onerror (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/download/node_modules/stream-combiner/index.js:36:18)
    at DestroyableTransform.emit (events.js:129:20)
    at onwriteError (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:250:10)
    at onwrite (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:268:5)
    at WritableState.onwrite (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:106:5)
    at afterTransform (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:104:5)```

@jacquesletesson
Copy link

Any idea why I got this error... yo doctor returns no problem.

As mentionned in #147 I deleted cache file but I'm still getting stuck during installation.

@Toddses
Copy link
Collaborator

Toddses commented Apr 3, 2015

Possibly the download failed. Have you tried running YeoPress with the --verbose flag? It should give more output.

@jacquesletesson
Copy link

@Toddses The output is the same with yo wordpress --verbose and I have a stable internet connection so it's really weird that the download failed.

@wesleytodd
Copy link
Owner Author

Try throwing some logging right here, console.error(err).

@jacquesletesson
Copy link

@wesleytodd Sorry for the late answer, I was focused on an other project.

I modified index.js as you advised :

console.error("Error(s) : " + err);
console.error("Remote : " + remote);

It returns :

Error(s) : Error: invalid characters in fileName: FJCore\IJG.txt
Remote : undefined

So it's somehow link to the FJCore library... Any ideas?

@dnzmsc
Copy link

dnzmsc commented Apr 9, 2015

@jacquesletesson I have the same problem! Where did you put the console.error rows? After remote.directory? As:

this.logger.log('Installing WordPress ' + this.conf.get('wpVer'));
    this.remote('wordpress', 'wordpress', this.conf.get('wpVer'), function(err, remote)
        remote.directory('.', this.conf.get('wpDir'));
        console.error("Error(s) : " + err);
        console.error("Remote : " + remote);
        this.logger.log(this.conf.get('wpDir'));
        this.logger.log('WordPress installed');
        done();
    }.bind(this));

@wesleytodd
Copy link
Owner Author

@jacquesletesson WOW....lol. So are you guys on windows?

@jacquesletesson
Copy link

@wesleytodd Not at all. OSX 10.10.2 – Yosemite.

@dnzmsc
Copy link

dnzmsc commented Apr 9, 2015

@wesleytodd No, I'm on Mac OSX 10.10.3 – Yosemite.

@wesleytodd
Copy link
Owner Author

Oh, well then it is weird that the directory separator is a \. Seems like that might be part of the problem

@jacquesletesson
Copy link

@dnzmsc Put it just before the line : remote.directory('.', this.conf.get('wpDir'));

@dnzmsc
Copy link

dnzmsc commented Apr 9, 2015

@wesleytodd I can't see this error as I wrote to @jacquesletesson

@wesleytodd wesleytodd reopened this Apr 9, 2015
@wesleytodd
Copy link
Owner Author

Not sure why I closed that....oops.

@wesleytodd
Copy link
Owner Author

The odd thing is that I cannot find FJCore anywhere in the wordpress source. So I am really not sure where this file is coming from. You both have cleared your yeoman cache right?

@jacquesletesson
Copy link

A quick video demo : http://quick.as/Z1OntY8qV

@wesleytodd The fact that remote is undefined is linked to a failed download?

@wesleytodd
Copy link
Owner Author

@jacquesletesson where did you find that? I am pretty sure that yeoman uses the github clone, so that is what I was searching.

Can you try changing your log to console.trace(err)? See where it is actually occurring.

@jacquesletesson
Copy link

@wesleytodd With the trace :

Trace: [Error: invalid characters in fileName: FJCore\IJG.txt]
    at Generator.<anonymous> (/usr/local/lib/node_modules/generator-wordpress/app/index.js:216:9)
    at Generator.<anonymous> (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/lib/actions/remote.js:79:21)
    at Stream.<anonymous> (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/lib/actions/fetch.js:70:21)
    at Stream.emit (events.js:129:20)
    at DestroyableTransform.onerror (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/download/node_modules/stream-combiner/index.js:36:18)
    at DestroyableTransform.emit (events.js:129:20)
    at onwriteError (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:250:10)
    at onwrite (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:268:5)
    at WritableState.onwrite (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:106:5)
    at afterTransform (/usr/local/lib/node_modules/generator-wordpress/node_modules/yeoman-generator/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:104:5)

@wesleytodd
Copy link
Owner Author

Maybe it should have been console.log(err.stack)? The lines in this are not really helpful....I was looking for a check on the filename that might throw this error.

@jacquesletesson
Copy link

@wesleytodd console.log(err.stack) returns an error : TypeError: Cannot read property 'stack' of null

Weirdly when I launch the generator with Wordpress installed as a submodule, the error occurs but all the files are downloaded and I can use the install.

@wesleytodd
Copy link
Owner Author

With git there is a different install path. So I am actually surprised the error occurs at all. This is going to be a harder one to track down. If you want to really dig in then I would be happy to merge a PR, but otherwise I will not be able to look at it until this weekend.

@dnzmsc
Copy link

dnzmsc commented Apr 9, 2015

@wesleytodd I made everything as @jacquesletesson but the only message I get is

................/usr/local/lib/node_modules/generator-wp-scaffold/app/index.js:155
        remote.directory('.', this.conf.get('wpDir'));
              ^
TypeError: Cannot read property 'directory' of undefined

@dnzmsc
Copy link

dnzmsc commented Apr 9, 2015

The name is wp-scaffold but it is the same generator

@jacquesletesson
Copy link

@wesleytodd @dnzmsc It drives me crazy so I want to understand why I got these errors... Let's assume the FJCore is somehow linked to my configuration... Why does the generator returns a value of undefined for this.remote?

Any way, I will keep digging into this issue.

@dnzmsc
Copy link

dnzmsc commented Apr 9, 2015

@jacquesletesson Please tell me if you solve!

@jacquesletesson
Copy link

@dnzmsc Does it work without issue while using GIT and Wordpress as a sub module?

@dnzmsc
Copy link

dnzmsc commented Apr 9, 2015

@jacquesletesson I didn't try, but I need not to use it in this way

@Toddses
Copy link
Collaborator

Toddses commented Apr 15, 2015

@jacquesletesson Can you do me a favor, take a look at the yeoman-generator package manifest and let me know what version you have installed?

@jacquesletesson
Copy link

@Toddses It's 0.18.10

@Toddses
Copy link
Collaborator

Toddses commented Apr 15, 2015

Thanks.

Okay here is what I'm finding. I know I'm probably basically talking to myself, but sometimes it helps to write things down and work it out that way.

I get this error 100% of the time when using yeoman-generator 0.18.10, which is the last 0.18 release. But yeoman-generator is on 0.19.1 right now. So I updated that module, and now I don't get the error. But there's a catch, yeoman-generator no longer extracts the archive. So you end up with a tarball in the cache, and the 4.1.1 wordpress tarball in the directory you ran YeoPress. And that's not really useful. So at the moment I'm hunting down what may have changed in the remote() call that makes yeoman-generator no longer extract the dang thing.

If I can't work anything out here in the next couple hours, we could force YeoPress to install yeoman-generator 0.18.7, thinking that would at least get YeoPress working while we figure out the issue and get yeoman-generator updated to 0.19.1.

@jacquesletesson
Copy link

That's sick. I didn't get that far... I should have though about updating yeoman-generator.
Let me know if I can be of any help.

@Toddses
Copy link
Collaborator

Toddses commented Apr 15, 2015

Here is the relevant issue: yeoman/generator#794

@Toddses
Copy link
Collaborator

Toddses commented Apr 15, 2015

Welp using yeoman-generator 0.18.7 doesn't do the trick. You're back to square one. I'm guessing one of the plugins it uses was updated, which broke the extract function. I'm kinda digging in there to see if I can figure it out.

@Toddses
Copy link
Collaborator

Toddses commented Apr 15, 2015

@jacquesletesson Can you take a look at your node version?

$ node -v

@Toddses
Copy link
Collaborator

Toddses commented Apr 15, 2015

I believe I've worked out a potential solution. But since YeoPress is so tied into the framework of the yeoman-generator, we may not be able to produce a new release until they get their fix in and released.

Looks to me like it has to do with the latest version of node and how readable streams are handled. Possibly it changed in the 0.12 release. A quick fix is to make a change in fetch.js. If you're willing and able to jump into your YeoPress installation, edit ./node-modules/yeoman-generator/lib/actions/fetch.js on line 64, change

res.on('data', function () {

to

res.on('readable', function () {

and that should get things working for you. It did for me at least.

@Toddses
Copy link
Collaborator

Toddses commented Apr 15, 2015

yeoman/generator#795

Keep an eye on that PR. When they either pull that in or create a different fix, we can go ahead and bump to the latest version of yeoman-generator and do a new release.

@Toddses
Copy link
Collaborator

Toddses commented Apr 16, 2015

Ok my fix was merged into the master a few minutes ago: yeoman/generator#796.

@wesleytodd do you want to wait until yeoman-generator issues a new release before we try and get YeoPress updated?

@wesleytodd
Copy link
Owner Author

We can probably get an alpha release with the fix by directly referencing the repo. I can do this tonight when I get home form work. But we wont do an actual release until they get their version stabilized.

@Toddses
Copy link
Collaborator

Toddses commented Apr 17, 2015

Perfect.

@wesleytodd
Copy link
Owner Author

yeoman/generator#800

Posted that. Looks like the tarball being copied over is solved by clearing cache after upgrading. But that means this would be backward incompatible.

Im working on updating develop right now and will push it soon.

@Toddses
Copy link
Collaborator

Toddses commented Apr 19, 2015

0.19.2 just released for yeoman-generator!

@wesleytodd
Copy link
Owner Author

3b4d740
ac6a41b

Give it a test. If you are happy we can close these out and release.

Also, I don't know if you saw this, but I posted an issue that might cause problems: yeoman/generator#800 (comment)

It works once you clear cache, but it looks backwards incompatible, so I dont know what they are going to want to do.

@Toddses
Copy link
Collaborator

Toddses commented Apr 19, 2015

I've been keeping my eye on that one, too. Seeing how it plays out.

I'll test the update here in a few.

@Toddses
Copy link
Collaborator

Toddses commented Apr 19, 2015

The update looks good to me. 👍

@wesleytodd
Copy link
Owner Author

Closing but not releasing. #152 is a serious blocker.

@theoptips
Copy link

I (on Mac Yosemite) got this error when I have underscores in my file/repo directory name e.g.
test_test --> throws error build couldn't finish
test --> no problem,instantly okay

@Toddses
Copy link
Collaborator

Toddses commented May 9, 2015

Open up a new issue for that.

@theoptips
Copy link

@Toddses good idea, done that. FYI link here #157

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

No branches or pull requests

5 participants