在软件包rxjs@5.0.0-beta.6中找不到模块“ /operator/share.js”

时间:2018-06-20 16:36:12

标签: angular

  • 角度版本:2
  • 编辑:Webstorm

当我通过npm start启动angular-2并刷新浏览器中的“应用”页面时,出现以下错误:

enter image description here

现在,如果我在新标签中以上述错误(如{https://npmcdn.com/rxjs@5.0.0-beta.6/operator/share.js)打开上述错误之一,则出现以下错误

Cannot find module "/operator/share.js" in package rxjs@5.0.0-beta.6

但是,如果我再次刷新新标签,则可以成功获取其代码正文,但是无论如何,我仍然会在我的App网页中遇到上述错误:

"use strict";
var multicast_1 = require('./multicast');
var Subject_1 = require('../Subject');
function shareSubjectFactory() {
    return new Subject_1.Subject();
}
/**
 * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
 * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
 * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
 * This is an alias for .publish().refCount().
 *
 * <img src="./img/share.png" width="100%">
 *
 * @return {Observable<T>} an Observable that upon connection causes the source Observable to emit items to its Observers
 * @method share
 * @owner Observable
 */
function share() {
    return multicast_1.multicast.call(this, shareSubjectFactory).refCount();
}
exports.share = share;
;
//# sourceMappingURL=share.js.map
  • 上述行为的原因是什么? 为什么第一次请求js文件返回Cannot find module....,但刷新后得到代码体?

  • 如何解决上述问题?

1 个答案:

答案 0 :(得分:0)

我找到了解决方法:

settingjs.config.js文件中,而不是

'rxjs': 'https://npmcdn.com/rxjs@5.0.0-beta.6',

我用过:

'rxjs': 'node_modules/rxjs',