gpt4 book ai didi

node.js - rxjs-redux observable 安装后未编译, Node 模块出现问题

转载 作者:太空宇宙 更新时间:2023-11-03 23:00:12 24 4
gpt4 key购买 nike

经过两天的裸安装战斗,并尝试按照 Egghead 的指南实现最简单的示例。

出于某种原因,我在 Node 模块查找其任何组件时遇到问题。

史诗索引:

import { Observable } from 'rxjs';
import {combineEpics} from 'redux-observable';

function loadStoriesEpic(action$) {
return action$
.do(action => console.log(action))
.ignoreElements();
}

export const rootEpic = combineEpics(loadStoriesEpic);

我在控制台上的实际错误无法编译。

RROR in ./node_modules/rxjs/Observable.js Module not found: Error: Can't resolve 'rxjs-compat/Observable' in '/Users/laxosceles/react-portfolio-solstice/node_modules/rxjs' @ ./node_modules/rxjs/Observable.js 6:9-42 @ ./node_modules/redux-observable/lib/esm/ActionsObservable.js @ ./node_modules/redux-observable/lib/esm/index.js @ ./src/index.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src

ERROR in ./node_modules/rxjs/Subject.js Module not found: Error: Can't resolve 'rxjs-compat/Subject' in '/Users/laxosceles/react-portfolio-solstice/node_modules/rxjs' @ ./node_modules/rxjs/Subject.js 6:9-39 @ ./node_modules/redux-observable/lib/esm/createEpicMiddleware.js @ ./node_modules/redux-observable/lib/esm/index.js @ ./src/index.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src

ERROR in ./node_modules/rxjs/observable/from.js Module not found: Error: Can't resolve 'rxjs-compat/observable/from' in '/Users/laxosceles/react-portfolio-solstice/node_modules/rxjs/observable' @ ./node_modules/rxjs/observable/from.js 6:9-47 @ ./node_modules/redux-observable/lib/esm/ActionsObservable.js @ ./node_modules/redux-observable/lib/esm/index.js @ ./src/index.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src

ERROR in ./node_modules/rxjs/observable/merge.js Module not found: Error: Can't resolve 'rxjs-compat/observable/merge' in '/Users/laxosceles/react-portfolio-solstice/node_modules/rxjs/observable' @ ./node_modules/rxjs/observable/merge.js 6:9-48 @ ./node_modules/redux-observable/lib/esm/combineEpics.js @ ./node_modules/redux-observable/lib/esm/index.js @ ./src/index.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src

ERROR in ./node_modules/rxjs/observable/of.js Module not found: Error: Can't resolve 'rxjs-compat/observable/of' in '/Users/laxosceles/react-portfolio-solstice/node_modules/rxjs/observable' @ ./node_modules/rxjs/observable/of.js 6:9-45 @ ./node_modules/redux-observable/lib/esm/ActionsObservable.js @ ./node_modules/redux-observable/lib/esm/index.js @ ./src/index.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src

ERROR in ./node_modules/rxjs/operator/filter.js Module not found: Error: Can't resolve 'rxjs-compat/operator/filter' in '/Users/laxosceles/react-portfolio-solstice/node_modules/rxjs/operator' @ ./node_modules/rxjs/operator/filter.js 6:9-47 @ ./node_modules/redux-observable/lib/esm/operators.js @ ./node_modules/redux-observable/lib/esm/index.js @ ./src/index.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src

ERROR in ./node_modules/rxjs/operator/map.js Module not found: Error: Can't resolve 'rxjs-compat/operator/map' in '/Users/laxosceles/react-portfolio-solstice/node_modules/rxjs/operator' @ ./node_modules/rxjs/operator/map.js 6:9-44 @ ./node_modules/redux-observable/lib/esm/createEpicMiddleware.js @ ./node_modules/redux-observable/lib/esm/index.js @ ./src/index.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src

ERROR in ./node_modules/rxjs/operator/switchMap.js Module not found: Error: Can't resolve 'rxjs-compat/operator/switchMap' in '/Users/laxosceles/react-portfolio-solstice/node_modules/rxjs/operator' @ ./node_modules/rxjs/operator/switchMap.js 6:9-50 @ ./node_modules/redux-observable/lib/esm/createEpicMiddleware.js @ ./node_modules/redux-observable/lib/esm/index.js @ ./src/index.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src Child html-webpack-plugin for "index.html": Asset Size Chunks Chunk Names db7499f085244c16cc8c.hot-update.json 44 bytes [emitted]
+ 1 hidden asset Entrypoint undefined = ./index.html

我不认为这与这个问题有关,但我还是要说,我最近将 Yarn 添加到了我的项目中,现在我使用“yarn add”安装了它,我认为它不应该是一个考虑到依赖关系显示在我的 package.json 中,出现了问题

最佳答案

我打赌您正在使用 rxjs v6redux-observable v.0.x 因为我看到存在导入错误(这就是 rxjs 中的重大更改) v6 和 redux-observable v.0.x 与 rxjs5 兼容。

您需要upgrade redux-observable或将 rxjs 降级到版本 5。

一个github issue .

关于node.js - rxjs-redux observable 安装后未编译, Node 模块出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50267979/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com