Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window下安装生态模块,导致目录丢失问题 #49

Open
myseawp opened this issue Dec 2, 2015 · 4 comments
Open

window下安装生态模块,导致目录丢失问题 #49

myseawp opened this issue Dec 2, 2015 · 4 comments

Comments

@myseawp
Copy link

myseawp commented Dec 2, 2015

问题描述:

我们有个生态组件结构大致如下:

1

在Windows下安装该组件,直接报错,我调试了下,发现windows下下载组件的zip解压会将目录合并,如下:

2

进一步调试发现,是因为decompress 0.2.3在windows下有bug:

kevva/decompress#14

将decompress升级到3.0.0版本

node_modules/ares-command-install/lib/package.js修改下载逻辑:

//var reader = fs.createReadStream(ball).on('error', done),
//    writer = reader.pipe(decompress({
//        ext: ext,
//        path: archive,
//        strip: 1
//    })).on('error', done).on('close', done);
//
//function done(err) {
//    //fs.unlinkSync(ball);
//    reader.removeListener('error', done);
//    writer.removeListener('error', done);
//    writer.removeListener('close', done);
//    if (err) {
//        rimraf.sync(archive);
//        return callback.call(that, err);
//    }
//    that.trim(archive, dest, callback);
//}

new decompress({mode: '755'})
            .src(ball)
            .dest(archive)
            .use(decompress.zip({strip: 1}))
            .run(function(error){
                if ( error ) {
                    console.log( error );
                } else {
                    console.log( "ok" );
                    that.trim(archive, dest, callback);
                }
            });

暂时问题解决,请关注下,代码修改有没有问题。

@fouber
Copy link
Member

fouber commented Dec 2, 2015

@myseawp

代码应该没问题,上面的 ares-command-install 是你基于scrat封装的新工具么?这个bug修复是需要在scrat中处理还是你在你的ares-command-install中已经解决了?

@myseawp
Copy link
Author

myseawp commented Dec 2, 2015

ares-command-install
是我们自己封装的工具,目前按这样的方式问题已经解决,来给你汇报下,
我看到现在scrat里使用的scrat-command-install,使用的也是decompress 0.2.3

应该也会有同样的问题

@fouber
Copy link
Member

fouber commented Dec 2, 2015

@myseawp 好,我也更新一下,多谢提醒

@atian25
Copy link
Member

atian25 commented Feb 1, 2016

@fouber 这个更新没? 要不要我这边处理?

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

No branches or pull requests

3 participants