2017-01-04 9 views
3

d3タイピングのインストールに問題があります。私はhttps://github.com/Microsoft/PowerBI-visuals/blob/master/Tutorial/Typings.mdでマイクロソフトの指示に従い、にSachin Patneyがビデオで行ったことに従った。電源BIカスタムビジュアル開発のd3タイピングインストールのトラブル

"npm install typing -g"を実行すると正常に動作しているようです。

"typings install --save --global dt〜d3"または "typings i dt〜d3 -G"を実行すると、このエラーが発生します: "入力ERR!メッセージ"グローバルモジュールとして "d3"をコンパイルしようとしました。外部モジュールのように見えますが、続行するにはグローバルオプションを削除する必要があります。

グローバルオプションを削除した場合、ビジュアルのフォルダに "globals"フォルダではなく "modules"フォルダ(MyVisual | typings | modules | d3ではなくMyVisual |タイピング|グローバル| d3)。 Intellisenseもd3では機能しません。

なぜ私はd3のタイプをグローバルにインストールできないのでしょうか?

答えて

5

@ FabioEnneの答えは、グローバルインストールとインテリセンスに関する私の問題を解決しましたが、私はまだその問題の最初の原因に関する他の問題に遭遇しました。しかし、私はジョン・ギャランによると

...私は修正を見つけたと思う:

The Power BI team just released v1.2 of the Custom Visuals SDK. With this version you now need to reference d3 v3.5.5 yourself. d3 v4 does not work yet. I’m working with the team to get a v4 compat and sample together, but for now you can only use v3.5.5.

(@ FabioEnneのソリューションは、私のシステムにv4.4.0を追加しました。)

ジョンはこの問題に対する解決策を提供します彼のサイトで:http://blog.jongallant.com/2016/11/pbiviz-12-d3-35-reference/。 (彼はビデオを含む)

Jonのソリューションのこの要旨は次のとおりです。

インストールタイピング:

npm i [email protected] --save 

はD3タイピングを追加します:

をD3のv3.5.5を追加
npm i -g typings 

typings install d3=github:DefinitelyTyped/DefinitelyTyped/d3/d3.d.ts#6e2f2280ef16ef277049d0ce8583af167d586c59 --global --save 

tsにファイルを追加するconfig.json:

{ 
    "compilerOptions": { 
    "allowJs": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "target": "ES5", 
    "sourceMap": true, 
    "out": "./.tmp/build/visual.js" 
    }, 
    "files": [ 
    ".api/v1.3.0/PowerBI-visuals.d.ts", 
    "typings/index.d.ts", 
    "node_modules/d3/d3.min.js", 
    "src/visual.ts" 
    ] 
} 
4

右、私は同じ問題を持っていた、これを行うと、細かいことyoul'll: は、手動でフォルダ「タイピング」 オープンのWindows PowerShellの内部のすべての内容を削除し、次のコマンドを入力します。

npm install @types/d3 

オープンtsconfig.jsonと以下のように変更します。私は継続することができた。このように

{ 
    "compilerOptions": { 
    "allowJs": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "target": "ES5", 
    "sourceMap": true, 
    "out": "./.tmp/build/visual.js" 
    }, 
    "files": [ 
    ".api/v1.3.0/PowerBI-visuals.d.ts", 
    "node_modules/@types/d3/index.d.ts", 
    "src/visual.ts" 
    ] 
} 

は、それは同様にあなたのために働いていた場合、私に知らせてください。

関連する問題