节点Angular2未正确设置

时间:2018-05-13 01:08:41

标签: node.js angular

我在nodeJS app中创建了名为“client”的文件夹,在这个文件夹中我创建了文件systemjs.config.js,tsconfig.json,typings.json,package.json。当我启动npm时,它不能成功编译我在npm启动时出错了。见下面的截图和代码

enter image description here

这是我的package.json文件

{
  "name": "mytasklist",
  "version": "1.0.0",
  "scripts": {
     "start": "tsc && concurrently \"tsc -w\"lite-server\" ",
     "lite": "lite-server",
     "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
 },
 "license": "ISC",
  "dependencies": {
   "@angular/common": "~2.0.1",
   "@angular/compiler": "~2.0.1",
   "@angular/core": "~2.0.1",
   "@angular/forms": "~2.0.1",
   "@angular/http": "~2.0.1",
   "@angular/platform-browser": "~2.0.1",
   "@angular/platform-browser-dynamic": "~2.0.1",
   "@angular/router": "~3.0.1",
   "@angular/upgrade": "~2.0.1",
   "angular-in-memory-web-api": "~0.1.1",
   "bootstrap": "^3.3.7",
   "core-js": "2.4.1",
   "reflect-metadata": "^0.1.8",
   "rxjs": "5.0.0-beta.12",
   "systemjs": "0.19.39",
   "zone.js": "^0.6.25"
 },
 "devDependencies": {
  "concurrently": "^3.0.0",
  "lite-server": "^2.2.2",
  "typescript": "^2.0.3",
  "typings": "^1.4.0"
}
}

这是我的systemjs.config.js

(function (global) {
System.config({
    paths: {
        // paths serve as alias
        'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
        // our app is within the app folder
        app : 'app', // 'dist',
        // 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',
        // other libraries
        'rxjs': 'npm:rxjs',
        'angular-in-memory-web-api': 'npm:angular-in-memory-web-api'
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
        app: { main: './main.js', defaultExtension: 'js' },
        rxjs: { defaultExtension: 'js' },
        'angular-in-memory-web-api': {
          main: './index.js',
          defaultExtension: 'js'
        }
    }
});
})(this);

这是我的tsconfig.js

 {
  "compilerOptions": {
  "target": "es5",
  "module": "commonjs",
  "moduleResolution": "node",
  "sourceMap": true,
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
  "removeComments": false,
"noImplicitAny": true
 }
}

这是typings.json文件

{
      "globalDependencies": {
      "core-js": "registry:dt/core-js#0.0.0+20160725163759",
       "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
      "node": "registry:dt/node#6.0.0+20160909174046"
      }
  }

0 个答案:

没有答案