LoginSignup
4
4

More than 5 years have passed since last update.

Windows(MINGW)でdtsmのセットアップに失敗する

Posted at

やろうとしたこと

AngularJSをTypeScriptで書くときのあれこれ
http://qiita.com/zoetro/items/1aefa189cb54169f2cee

を参考に

vvakame/angularjs-typescript
https://github.com/vvakame/angularjs-typescript

を使う

いきなり躓く

$ ./setup.sh
Running "dtsm:client" (dtsm) task
fetching https://github.com/borisyankov/DefinitelyTyped.git
>> Error: Command failed: fatal: Path 'jquery\jquery.d.ts' d
Warning: Task "dtsm:client" failed. Use --force to continue.

Aborted due to warnings.

どうやらreferenceの解決に失敗している感じ?

原因

原始的にconsoleデバッグしながら少しずつ原因箇所に迫っていくと
処理系はパス区切りに「/」を使いたいところで「\」が返ってくるため失敗している模様。

https://nodejs.org/api/path.html#path_path_join_path1_path2

一応この辺までは処理を辿った

解決策

angularjs-typescript\node_modules\grunt-dtsm\node_modules\dtsm\node_modules\lib\manager.js
    Manager.prototype._installFromOptions = function (recipe, opts) {
        var _this = this;
        if (opts === void 0) { opts = {}; }
        var baseRepo = recipe && recipe.repos && recipe.repos[0] || this.repos[0];
        return this.backend
            .getByRecipe({
            baseRepo: baseRepo.url,
            baseRef: baseRepo.ref,
            path: recipe.path,
            dependencies: recipe.dependencies,
            postProcessForDependency: function (result, depResult, content) {
                var dependencies = utils.extractDependencies(content.toString("utf8"));
                dependencies.forEach(function (detected) {
                    var obj = result.toDepNameAndPath(detected);
                    result.pushAdditionalDependency(obj.depName, {
                        repo: depResult.repo,
                        ref: depResult.ref,
-                       path: obj.path
+                       path: obj.path.replace(/\\/, '/')
                    });
                });
            },

ホントはpathの中とかもっと根本的な部分で解決するのがよかったんだろうけど今回は妥協。

4
4
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4