2016-05-11 3 views
-1

ich das Eckige 2.My Projekt verwenden funktioniert, aber die folgenden Fehler in Visual Studio angezeigt:Ambient Moduldeklaration kann nicht angeben, relativ Modulnamen

enter image description here

typings.json:

{ 
     "ambientDependencies": { 
     "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd" 
    } 
} 

package.json:

{ 
    "name": "asp-net-angular2", 
    "version": "1.0.0", 
    "author": "TestStack", 
    "description": "", 
    "scripts": { 
     "postinstall": "typings install" 
    }, 
    "license": "Apache-2.0", 
    "dependencies": { 
     "@angular/common": "2.0.0-rc.1", 
     "@angular/compiler": "2.0.0-rc.1", 
     "@angular/core": "2.0.0-rc.1", 
     "@angular/http": "2.0.0-rc.1", 
     "@angular/platform-browser": "2.0.0-rc.1", 
     "@angular/platform-browser-dynamic": "2.0.0-rc.1", 
     "@angular/router": "2.0.0-rc.1", 
     "@angular/router-deprecated": "2.0.0-rc.1", 
     "@angular/upgrade": "2.0.0-rc.1", 

     "systemjs": "0.19.27", 
     "es6-shim": "^0.35.0", 
     "es6-promise": "^3.1.2", 
     "reflect-metadata": "^0.1.3", 
     "rxjs": "5.0.0-beta.6", 
     "zone.js": "^0.6.12", 

     "angular2-in-memory-web-api": "0.0.7", 
     "bootstrap": "^3.3.6", 
     "jquery": "^2.2.3" 
    }, 
    "devDependencies": { 
     "typescript": "^1.8.10", 
     "gulp": "^3.9.1", 
     "path": "^0.12.7", 
     "gulp-clean": "^0.3.2", 
     "fs": "^0.0.2", 
     "gulp-concat": "^2.6.0", 
     "gulp-typescript": "^2.13.1", 
     "gulp-tsc": "^1.1.5", 
     "del": "^2.2.0", 
     "gulp-autoprefixer": "^3.1.0", 
     "gulp-cssnano": "^2.0.0", 
     "gulp-html-replace": "^1.5.4", 
     "gulp-htmlmin": "^1.0.5", 
     "gulp-uglify": "^1.5.3", 
     "merge-stream": "^1.0.0", 
     "systemjs-builder": "^0.15.16", 

     "typings": "^0.8.1" 
    }, 
    "repository": { } 
} 

tsconfig.json:

{ 
    "compileOnSave": true, 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "noEmitOnError": true, 
    "removeComments": false, 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "noImplicitAny": false, 
    "suppressImplicitAnyIndexErrors": true 
    }, 
    "exclude": [ 
    "node_modules", 
    "wwwroot", 
    "typings/main", 
    "typings/main.d.ts" 
    ] 
} 

und Projekteinstellung:

<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> 
    <TypeScriptTarget>ES5</TypeScriptTarget> 
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit> 
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled> 
    <TypeScriptEmitDecoratorMetadata>True</TypeScriptEmitDecoratorMetadata> 
    <TypeScriptNoImplicitAny>True</TypeScriptNoImplicitAny> 
    <TypeScriptModuleKind>CommonJS</TypeScriptModuleKind> 
    <TypeScriptRemoveComments>False</TypeScriptRemoveComments> 
    <TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators> 
    <TypeScriptOutFile /> 
    <TypeScriptOutDir /> 
    <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations> 
    <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError> 
    <TypeScriptSourceMap>True</TypeScriptSourceMap> 
    <TypeScriptMapRoot /> 
    <TypeScriptSourceRoot /> 
    </PropertyGroup> 

Wie beseitigen wir diese errors.I versucht, aber nicht gelang. mein Fehler auf .d.ts Datei:

Ambient Moduldeklaration angeben kann nicht Name relativ Modul

+0

eine Sache, was ich dir vorschlagen könnte, ist "ES5" sollte zu "ES6" geändert werden, aber immer noch möchte ich wissen, wie Sie das funktioniert haben? –

Antwort

0

ich sehe Sie tsconfig.json haben, so dass Sie Befehlszeile verwenden könnten Ihre tsc-Dateien zu erstellen.

Sie können weiter unten in den Projekteinstellungen, indem Kompilierung in Visual Studio blockieren (und alle Fehler gehen weg, wie Sie nicht in VS bauen),

<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> 

sonst können Sie ts Dateien und Haupt einschließen. d.ts explizit durch Hinzufügen dieser in Projekteinstellungen.

<ItemGroup> 
    <TypeScriptCompile Include="$(ProjectDir)\src\**\*.ts" /> 
</ItemGroup> 
<ItemGroup> 
    <TypeScriptCompile Include="$(ProjectDir)\src\main.d.ts" /> 
</ItemGroup> 

Hoffe, das hilft !!

+0

das hat mir nicht geholfen, hast du noch eine alternative? –