2016-05-16 11 views
12

我有「AngularClass」angular2-webpack-starter項目 我已經安裝了所有npm依賴關係 現在我試圖安裝分型試圖編譯「zone.js」作爲外部模塊,但它看起來像一個全局模塊

typings.json

{ 
    "dependencies": { 
    "zone.js": "github:gdi2290/typed-zone.js#66ea8a3451542bb7798369306840e46be1d6ec89" 
    }, 
    "devDependencies": {}, 
    "ambientDependencies": { 
    "angular-protractor": "github:DefinitelyTyped/DefinitelyTyped/angular-protractor/angular-protractor.d.ts#64b25f63f0ec821040a5d3e049a976865062ed9d", 
    "core-js": "registry:dt/core-js#0.0.0+20160317120654", 
    "hammerjs": "github:DefinitelyTyped/DefinitelyTyped/hammerjs/hammerjs.d.ts#74a4dfc1bc2dfadec47b8aae953b28546cb9c6b7", 
    "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#4b36b94d5910aa8a4d20bdcd5bd1f9ae6ad18d3c", 
    "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#8cf8164641be73e8f1e652c2a5b967c7210b6729", 
    "selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#a83677ed13add14c2ab06c7325d182d0ba2784ea", 
    "webpack": "github:DefinitelyTyped/DefinitelyTyped/webpack/webpack.d.ts#95c02169ba8fa58ac1092422efbd2e3174a206f4" 
    } 
} 

當我輸入

sudo typings install 

derzunov:angular2-webpack-starter derzunov$ sudo typings install 
typings ERR! message Attempted to compile "zone.js" as an external module, but it looks like a global module. 

typings ERR! cwd /Users/derzunov/projects/Angular2/angular2-webpack-starter 
typings ERR! system Darwin 15.4.0 
typings ERR! command "/usr/local/bin/node" "/usr/local/bin/typings" "install" 
typings ERR! node -v v4.4.4 
typings ERR! typings -v 1.0.2 

typings ERR! If you need help, you may report this error at: 
typings ERR! <https://github.com/typings/typings/issues> 

這是什麼意思? 幫助! =))

+0

我懷疑它需要'-g'進行全局安裝。 'sudo install -g typings' –

+1

@SterlingArcher:No;這是一個角度預編譯器的事情。 – SLaks

+0

@SLaks我做錯了什麼? – derzunov

回答

20

類型1.0.x有一些breaking changes。將「zone.js」放入「ambientDependencies」部分,並將其重命名爲「globalDependencies」

+1

我有同樣的問題,並修改typings.json文件上述指示解決了我的問題。 –

+0

謝謝你,阿列克謝!這解決了這個問題。 – derzunov

+0

也適用於我。即使許多其​​他線路在ambientDependencies下,也不要害怕做出改變。 –