今天准备使用一下Ant Design Pro,全程按照使用文档进行项目的构建和启动,结果启动时报如下错误:
ERROR in ./src/components/index.md
Module build failed (from ./node_modules/@umijs/preset-dumi/lib/loader/index.js): Error: [BABEL] @babel/helper-compilation-targets: 'opera_mobile' is not a valid target
### 问题出现的环境背景及自己尝试过哪些方法
Ant Design Pro版本:5.2.0
node.js:v18.12.1
npm:8.19.2
目前已经试过删除node_modules文件夹,并重新安装依赖包,依旧报错。
### 相关代码
package.json文件:
{
"name": "ant-design-pro",
"version": "5.2.0",
"private": true,
"description": "An out-of-box UI solution for enterprise applications",
"scripts": {
"analyze": "cross-env ANALYZE=1 umi build",
"build": "umi build",
"deploy": "npm run build && npm run gh-pages",
"dev": "npm run start:dev",
"gh-pages": "gh-pages -d dist",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"postinstall": "umi g tmp",
"lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier && npm run tsc",
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:prettier": "prettier -c --write \"src/**/*\" --end-of-line auto",
"lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
"openapi": "umi openapi",
"playwright": "playwright install && playwright test",
"prepare": "husky install",
"prettier": "prettier -c --write \"src/**/*\"",
"serve": "umi-serve",
"start": "set NODE_OPTIONS=--openssl-legacy-provider && cross-env UMI_ENV=dev umi dev",
"start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev",
"start:no-mock": "cross-env MOCK=none UMI_ENV=dev umi dev",
"start:no-ui": "cross-env UMI_UI=none UMI_ENV=dev umi dev",
"start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev umi dev",
"start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev umi dev",
"test": "umi test",
"test:component": "umi test ./src/components",
"test:e2e": "node ./tests/run-tests.js",
"tsc": "tsc --noEmit"
},
"lint-staged": {
"**/*.less": "stylelint --syntax less",
"**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
"**/*.{js,jsx,tsx,ts,less,md,json}": [
"prettier --write"
]
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 10"
],
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@ant-design/pro-components": "1.1.1",
"@umijs/route-utils": "^2.0.0",
"antd": "^4.20.0",
"classnames": "^2.3.0",
"lodash": "^4.17.0",
"moment": "^2.29.0",
"omit.js": "^2.0.2",
"rc-menu": "^9.1.0",
"rc-util": "^5.16.0",
"react": "^17.0.0",
"react-dev-inspector": "^1.7.0",
"react-dom": "^17.0.0",
"react-helmet-async": "^1.2.0",
"umi": "^3.5.0"
},
"devDependencies": {
"@ant-design/pro-cli": "^2.1.0",
"@playwright/test": "^1.17.0",
"@types/classnames": "^2.3.1",
"@types/express": "^4.17.0",
"@types/history": "^4.7.0",
"@types/jest": "^26.0.0",
"@types/lodash": "^4.14.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-helmet": "^6.1.0",
"@umijs/fabric": "^2.11.1",
"@umijs/openapi": "^1.6.0",
"@umijs/plugin-blocks": "^2.2.0",
"@umijs/plugin-esbuild": "^1.4.0",
"@umijs/plugin-openapi": "^1.3.3",
"@umijs/preset-ant-design-pro": "^1.3.0",
"@umijs/preset-dumi": "^1.1.0",
"@umijs/preset-react": "^2.1.0",
"cross-env": "^7.0.0",
"cross-port-killer": "^1.3.0",
"detect-installer": "^1.0.0",
"eslint": "^7.32.0",
"gh-pages": "^3.2.0",
"husky": "^7.0.4",
"jsdom-global": "^3.0.0",
"lint-staged": "^10.0.0",
"mockjs": "^1.1.0",
"prettier": "^2.5.0",
"stylelint": "^13.0.0",
"swagger-ui-dist": "^4.12.0",
"typescript": "^4.5.0",
"umi-serve": "^1.9.10"
},
"engines": {
"node": ">=12.0.0"
}
}
期待能够正常启动项目,实际一直报同样的错误
我在今天也遇到了这个情况,现在解决了。但我不是专业前端,只能描述下解决方法
解决方法:
1 删除当前项目中./src/components/index.md文件,然后运行。
如果还是失败,则执行下面第二步(非必须)
2 降低pro工具的版本为3.0.0(参考命令:npm i @ant-design/pro-cli@3.0.0 -g )
我今天也遇到相同问题,解决办法参考:https://github.com/ant-design/ant-design-pro/issues/10829 ,就是删除这个文件 ./src/components/index.md,我建的项目是 simple,删了之后直接可以运行。
降低一下小版本号,试试。没遇到过这个情况。
模块构建失败(来自./node_modules/babel loader/lib/index.js): 错误:在函数“F:\reactapp” 中找不到模块“@babel/preset-es2015”。单元在resolveStandardizedName(F:\reactapp\node\u modules\resolve\lib\sync.js:43:15)处导出[作为同步] _modules@
更改历史 * 2018-1-7 高天阳 2.2.2图片改文字 * 2018-1-6 高天阳 格式化文档 * 2017-5-11 高天阳 初始化文档 1 简介、用途 1.1 简介 标准的制定者计划,以后每年发布一次标准,使用年份作为版本号。ES6是在2015年发布的,所以又称为ES2015。 但ES6其实多用于泛指ES5.1版本后的下一代JS标准,它涵盖在ES2015版本上
Babel 是编写下一代 JavaScript 的编译器。 ES2015 and beyond。Babel 默认使用一组 ES2015 语法转换器,允许你使用新的语法,无需等待浏览器支持。 JSX and React。Babel 内置支持 JSX,与 babel-sublime 包一起结合,将语法高亮功能带到一个新的高度。 Pluggable。Babel 支持用户插件。允许你插入强大的 Babe
如下图:
我已经安装了Babel7.5,这应该是理想的目标预置环境包,但不确定为什么它正在寻找“Babel-Preset-ES2015”。 你们能告诉我我犯了什么错误吗?下面是我的代码 package.json .babelrc 模块生成失败(来自./node_modules/babel-loader/lib/index.js): 错误:从“d:\shashank\projects\uploadutilit
本文向大家介绍启动hadoop报如下错误,该如何解决?相关面试题,主要包含被问及启动hadoop报如下错误,该如何解决?时的应答技巧和注意事项,需要的朋友参考一下 --1.error org.apache.hadoop.hdfs.server.namenode.NameNode --找不到主类,应该是配置文件的hadoop的安装位置配置错误,对hadoop-env.sh文件进行检查修改 --2.o