Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run build 报错 #108

Closed
xiaobo0113 opened this issue May 22, 2020 · 3 comments
Closed

npm run build 报错 #108

xiaobo0113 opened this issue May 22, 2020 · 3 comments

Comments

@xiaobo0113
Copy link

TypeScript error in D:/xiaobo/work/Github/react-admin/node_modules/jest-diff/build/diffLines.d.ts(8,13):
'=' expected. TS1005

 6 |  */
 7 | import { Diff } from './cleanupSemantic';

8 | import type { DiffOptions } from './types';
| ^
9 | export declare const diffLinesUnified: (aLines: string[], bLines: string[], options?: DiffOptions | undefined) => string;
10 | export declare const diffLinesUnified2: (aLinesDisplay: string[], bLinesDisplay: string[], aLinesCompare: string[], bLinesCompare: string[], options?: DiffOptions | undefined) => string;
11 | export declare const diffLinesRaw: (aLines: string[], bLines: string[]) => Diff[];

@yezihaohao
Copy link
Owner

没复现出问题,你是升级了依赖包吗?

问题在jest issues里面可以找到及解决方案,可以参考一下:jestjs/jest#9703

@xiaobo0113
Copy link
Author

我什么都没有改,你可以试着从仓库重新clone一个下来试试,看看能不能复现

@xiaobo0113
Copy link
Author

xiaobo0113 commented May 27, 2020

1.jest使用的是24.9.0版本,但是查看node_modules/jest-diff/package.json文件,发现使用的是26.0.1版本

2.在package.json中写的是"echarts-for-react": "^2.0.15-beta.1",注意有个^符号,导致了npm i的时候会去获取新版本,查看node_modules/echarts-for-react/package.json文件,发现是"echarts-for-react@2.0.16",即下载了2.0.16版本的echarts-for-react,导致了和你代码中使用的api不一致。

解决办法:
1.在package.json中添加"jest-diff": "24.9.0"指定使用24.9.0的jest-diff
2.在package.json中更新为`"echarts-for-react": "2.0.15-beta.1"指定使用2.0.15-beta.1版本的echarts-for-react

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants