search

Home  >  Q&A  >  body text

angular.js - angular2+webpack compilation error

Please help me take a look, I’ve been waiting all morning, waiting online, thank you in advance!
Error message:

ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts
(8,28): error TS2307: Cannot find module 'rxjs/Observable'.

ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts
(9,25): error TS2307: Cannot find module 'rxjs/Subject'.

ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts
(10,28): error TS2307: Cannot find module 'rxjs/Observable'.

ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts
(11,25): error TS2307: Cannot find module 'rxjs/Subject'.

tsconfig.json

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "moduleResolution": "node",
        "sourceMap": true,
        "experimentalDecorators": true
    },
    "buildOnSave": false,
    "compileOnSave": false,
    "exclude": [
        "node_modules"
    ]
}

index.ts

import "es6-shim";
import "rx";
import {Component} from '@angular/core';
仅有的幸福仅有的幸福2779 days ago555

reply all(2)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 17:05:54

    I have found the answer. I used the wrong library. It should be rxjs instead of rx.

    reply
    0
  • 为情所困

    为情所困2017-05-15 17:05:54

    Say yesrxjs/Observable没找到,你装了rx了么?npm install --save rxjs@5.0.0-beta.6

    Also, try removing it againimport "rx";.

    Finally, compare the webpack+angular2 environment to see if there are any differences

    reply
    0
  • Cancelreply