2017-03-12 5 views
0

각도 2 응용 프로그램을 만들고 터치 제스처에 hammerjs를 사용하려고합니다. 현재 Angular 2의 빠른 시작 응용 프로그램과 Hammerjs sample의 hammerjs 응용 프로그램을 결합하려고합니다.angular2 및 typescript 오류

내가 오류가 계속 :

http://localhost:3000/npm:[email protected]/lib/plugin.js Failed to load resource: the server responded with a status of 404 (Not Found) 
localhost/:33 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/npm:[email protected]/lib/plugin.js 
Error: XHR error (404 Not Found) loading http://localhost:3000/npm:[email protected]/lib/plugin.js 
Error loading http://localhost:3000/npm:[email protected]/lib/plugin.js 
Unable to load transpiler to transpile http://localhost:3000/app/app.component.js 
Error loading http://localhost:3000/app/app.component.js 

내 systemjs.config.js 파일 :

(function (global) { 
    System.config({ 
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER 
transpiler: 'ts', 
typescriptOptions: { 
    tsconfig: true 
}, 
meta: { 
    'typescript': { 
    "exports": "ts" 
    } 
}, 
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', 

    // 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/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js', 

    // other libraries 
    'rxjs':      'npm:rxjs', 
    'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api', 
    'ts':       'npm:[email protected]/lib/plugin.js', 
    'typescript':     'npm:[email protected]/lib/typescript.js', 

}, 
// packages tells the System loader how to load when no filename and/or no extension 
packages: { 
    app: { 
    main: './app.component.js', 
    defaultExtension: 'js' 
    }, 
    rxjs: { 
    defaultExtension: 'js' 
    }, 
    'angular2-in-memory-web-api': { 
    main: './index.js', 
    defaultExtension: 'js' 
     } 
    } 
    }); 
})(this); 

내 폴더 구조 :

Folder Structure

mypackage.json 파일 :

{ 
    "name": "angular-quickstart", 
    "version": "1.0.0", 
    "description": "QuickStart package.json from the documentation,  supplemented with testing support", 
    "scripts": { 
"build": "tsc -p src/", 
"build:watch": "tsc -p src/ -w", 
"build:e2e": "tsc -p e2e/", 
"serve": "lite-server -c=bs-config.json", 
"serve:e2e": "lite-server -c=bs-config.e2e.json", 
"prestart": "npm run build", 
"start": "concurrently \"npm run build:watch\" \"npm run serve\"", 
"pree2e": "npm run build:e2e", 
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first", 
"preprotractor": "webdriver-manager update", 
"protractor": "protractor protractor.config.js", 
"pretest": "npm run build", 
"test": "concurrently \"npm run build:watch\" \"karma start  karma.conf.js\"", 
"pretest:once": "npm run build", 
"test:once": "karma start karma.conf.js --single-run", 
"lint": "tslint ./src/**/*.ts -t verbose" 
    }, 
    "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-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.2.0", 
    "lite-server": "^2.2.2", 
    "typescript": "~2.0.10", 

    "canonical-path": "0.0.2", 
    "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" 
    }, 
    "repository": {} 
} 

모든 npm 설치 모듈을 설치했습니다.

무엇이 누락 되었습니까?

+1

명령 줄에서 npm 설치를 실행 했습니까? package.json 파일의 내용은 무엇입니까? 이 라이브러리를 찾을 수 없습니다 : npm : [email protected]/lib/plugin.js –

+0

질문을 업데이트했습니다. 나는 npm을 설치했고 모든 의존성을 가지고있다. 그런데 plugin.js는 node_modules/typescript 폴더에 없습니다. – KBE

+1

이것은 누락 된 라이브러리입니다 (https://github.com/frankwallis/plugin-typescript). 이것은 타이프 스크립트 라이브러리가 아니며 타사 라이브러리입니다. – Claies

답변

1

당신은 아마 (SystemJS에 대한 ypeScript 로더의 문서에서)이 필요합니다 당신이 (당신이 NPM을 사용하는) 니혼 전자 : JSPM없이 SystemJS를 사용하는 경우, 플러그인 - 타이프 라이터와 타이프 라이터에 대한 SystemJS 맵 구성을 추가 :

SystemJS.config({ 
    packages: { 
    "ts": { 
     "main": "plugin.js" 
    }, 
    "typescript": { 
     "main": "lib/typescript.js", 
     "meta": { 
     "lib/typescript.js": { 
      "exports": "ts" 
     } 
     } 
    } 
    }, 
    map: { 
    "ts": "path/to/plugin-typescript/lib", 
    "typescript": "path/to/typescript" 
    }, 
    transpiler: 'ts' 
}); 
관련 문제