2017-01-12 75 views
1

我想在visual studio 2015 asp.net核心1.1中設置角2,我在構建時遇到此錯誤。爲什麼不能建立發現模塊@angular升級靜態

enter image description here

有問題的文件上面的圖片中是在路由器文件夾

enter image description here

這裏是我的package.json

{ 
    "name": "sample", 
    "version": "1.0.0", 
    "description": "", 
    "scripts": { 
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ", 
    "e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first", 
    "lint": "tslint ./app/**/*.ts -t verbose", 
    "lite": "lite-server", 

    "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"", 
    "test-once": "tsc && karma start karma.conf.js --single-run", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w" 
    }, 
    "keywords": [], 
    "author": "", 
    "license": "MIT", 
    "dependencies": { 
    "@angular/common": "~2.4.0", 
    "@angular/compiler": "~2.4.0", 
    "@angular/core": "~2.4.0", 
    "@angular/forms": "~2.4.0", 
    "@angular/http": "~2.4.0", 
    "@angular/platform-browser": "~2.4.0", 
    "@angular/platform-browser-dynamic": "~2.4.0", 
    "@angular/router": "^3.4.0", 
    "@angular/material": "^2.0.0-beta.1", 
    "@angular/upgrade": "^2.1.0", 

    "angular-in-memory-web-api": "~0.2.4", 
    "systemjs": "0.19.40", 
    "core-js": "^2.4.1", 
    "rxjs": "5.0.1", 
    "zone.js": "^0.7.4" 
    }, 
    "devDependencies": { 
    "concurrently": "^3.1.0", 
    "lite-server": "^2.2.2", 
    "typescript": "~2.0.10", 

    "canonical-path": "0.0.2", 
    "http-server": "^0.9.0", 
    "tslint": "^3.15.1", 
    "lodash": "^4.16.4", 
    "jasmine-core": "~2.4.1", 
    "karma": "^1.3.0", 
    "karma-chrome-launcher": "^2.0.0", 
    "karma-cli": "^1.0.1", 
    "karma-jasmine": "^1.0.2", 
    "karma-jasmine-html-reporter": "^0.2.2", 
    "protractor": "~4.0.14", 
    "rimraf": "^2.5.4", 

    "@types/node": "^6.0.46", 
    "@types/jasmine": "^2.5.36", 


    "gulp": "^3.9.1", 
    "gulp-clean": "^0.3.2", 
    "gulp-concat": "^2.6.0", 
    "gulp-rename": "^1.2.2", 
    "gulp-tsc": "^1.2.0", 
    "gulp-typescript": "^2.13.6", 
    "gulp-uglify": "^2.0.0", 
    "path": "^0.12.7" 

    }, 
    "repository": {} 
} 

這裏是tsconfig.js

"compileOnSave": true, 
    "compilerOptions": { 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "module": "commonjs", 
    "noEmitOnError": true, 
    "noImplicitAny": true, 
    "outDir": "wwwroot/scripts/", 
    "removeComments": false, 
    "sourceMap": true, 
    "suppressImplicitAnyIndexErrors": true, 
    "target": "es5", 
    "lib": [ "es2015", "dom" ], 
    "moduleResolution": "node", 
    "types": [ 

     "jasmine" 
    ], 
    "typeRoots": [ "node_modules/@types" ] 
    }, 
    "exclude": [ 
    "node_modules", 
    "typings/index", 
    "typings/index.d.ts" 
    ] 
} 

的systemconfig.js

(function (global) { 
    System.config({ 
     paths: { 

      'npm:': 'lib/' 
     }, 
     // map tells the System loader where to look for things 
     map: { 
      // our app is within the app folder 
      app: 'scripts', 
      // angular bundles 
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 
      '@angular/material': 'npm:@angular/material/material.umd.js', 

      'rxjs': 'npm:rxjs' 

     }, 

     packages: { 
      app: { 
       main: './main.js', 
       defaultExtension: 'js' 
      }, 
      rxjs: { 
       defaultExtension: 'js' 
      } 
     } 
    }); 
})(this); 

我已經吞下腳本複製到lib文件夾中。

我缺少什麼?

回答

3

我有同樣的問題,這是爲我工作。

如果你看看upgrade.d.ts文件,裏面VS 2015年,你會發現,有上import語句紅色波浪線爲「@角/升級/靜態」

upgrade.d.ts

我搜索了node-modules文件夾中的這個依賴關係,它不在那裏。 所以我通過運行以下命令

運行NPM我@角安裝了/升級

錯誤走了安裝後。

我希望這會有所幫助。

最好的問候,

0

如果您使用NPM,請確保您已經添加了一個參考,以「@角/升級」您的package.json文件中。

例如

"dependencies": { 
"@angular/common": "~2.4.0", 
"@angular/compiler": "~2.4.0", 
"@angular/core": "~2.4.0", 
"@angular/forms": "~2.4.0", 
"@angular/http": "~2.4.0", 
"@angular/platform-browser": "~2.4.0", 
"@angular/platform-browser-dynamic": "~2.4.0", 
"@angular/router": "~3.4.0", 
"@angular/upgrade": "~2.4.0", <------------------- Add this 

保存更改,然後右鍵單擊 - >「還原包」。如果您轉到您的node_modules/@ angular文件夾,現在應該看到丟失的升級子文件夾。

相關問題