- npx 指定umi版本号安装
npx @umijs/create-umi-app@3.4.25
之后用
yarn
安装项目依赖
- 高版本nodejs下,跑项目会出异常:
Starting the development server...
* Webpack █████████████████████████ building (10%) 1/2 modules 1 active
...odules\umi\node_modules\@umijs\preset-built-in\bundled\@pmmmwh\react-refresh-webpack-plugin\client\ReactRefreshEnt
ry.js
node:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports.__webpack_modules__.57442.module.exports (G:\React Project\LeApp3x\node_modules\@umijs\deps\compiled\webpack\4\bundle4.js:135907:62)
at NormalModule._initBuildHash (G:\React Project\LeApp3x\node_modules\@umijs\deps\compiled\webpack\4\bundle4.js:109317:16)
at handleParseError (G:\React Project\LeApp3x\node_modules\@umijs\deps\compiled\webpack\4\bundle4.js:109371:10)
at G:\React Project\LeApp3x\node_modules\@umijs\deps\compiled\webpack\4\bundle4.js:109403:5
at G:\React Project\LeApp3x\node_modules\@umijs\deps\compiled\webpack\4\bundle4.js:109258:12
at G:\React Project\LeApp3x\node_modules\@umijs\deps\compiled\webpack\4\bundle4.js:61157:3
at iterateNormalLoaders (G:\React Project\LeApp3x\node_modules\@umijs\deps\compiled\webpack\4\bundle4.js:60998:10)
at Array.<anonymous> (G:\React Project\LeApp3x\node_modules\@umijs\deps\compiled\webpack\4\bundle4.js:60989:4) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
修复方法:
在项目目录下:
$env:NODE_OPTIONS="--openssl-legacy-provider"
之后项目就能正常跑了
Starting the development server...
√ Webpack
Compiled successfully in 17.63s
DONE Compiled successfully in 17629ms