前端
安装yarn
https://www.lsbin.com/wp-content/themes/begin%20lts/inc/go.php?url=https://github.com/yarnpkg/yarn/releases/download/v1.22.4/yarn-1.22.4.msi
npx create-react-app antd-demo-ts --template typescript
1、cmd查看当前node版本和node安装位置
node -v
where node
2、百度搜索“node+需要版本”管网下载LTS版本的nodejs。安装到之前的目录即可
node 下载地址https://nodejs.org/zh-cn/download/releases/
d:\Program Files\nodejs
D:\Program Files\nodejs>yarn create react-app antd-demo-ts --template typescript
cd antd-demo-ts
yarn start
Module.createRequire is not a function
assets by path static/ 1.49 MiB
asset static/js/bundle.js 1.48 MiB [emitted] (name: main) 1 related asset
asset static/js/node_modules_web-vitals_dist_web-vitals_js.chunk.js 6.93 KiB [emitted] 1 related asset
asset static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg 2.57 KiB [emitted] (auxiliary name: main)
asset index.html 579 bytes [emitted]
asset asset-manifest.json 546 bytes [emitted]
runtime modules 31.3 KiB 15 modules
modules by path ./node_modules/ 1.35 MiB 99 modules
modules by path ./src/ 18.1 KiB
modules by path ./src/*.css 8.82 KiB
./src/index.css 2.72 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/index.css 1.37 KiB [built] [code generated]
./src/App.css 2.72 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/App.css 2 KiB [built] [code generated]
modules by path ./src/*.tsx 4.33 KiB
./src/index.tsx 1.8 KiB [built] [code generated]
./src/App.tsx 2.53 KiB [built] [code generated]
./src/reportWebVitals.ts 1.39 KiB [built] [code generated]
./src/logo.svg 3.61 KiB [built] [code generated]
ERROR in Module.createRequire is not a function
ERROR in Error: Child compilation failed:
Module.createRequire is not a function
- child-compiler.js:169 childCompiler.runAsChild
[antd-demo-ts]/[html-webpack-plugin]/lib/child-compiler.js:169:18
- Compiler.js:564 compile
[antd-demo-ts]/[webpack]/lib/Compiler.js:564:11
- Compiler.js:1183 hooks.afterCompile.callAsync.err
[antd-demo-ts]/[webpack]/lib/Compiler.js:1183:17
- next_tick.js:68 process._tickCallback
internal/process/next_tick.js:68:7
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack 5.70.0 compiled with 3 errors in 134058 ms
No issues found.