fiora
fiora copied to clipboard
构建客户端代码时报错
报错内容 @fiora/web: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. lerna ERR! yarn run build:web exited 1 in '@fiora/web' error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 请问如何解决
这些信息没有用, 要看再往上面一些的内容是啥
@fiora/web: ℹ Compiling Webpack @fiora/web: Error: error:0308010C:digital envelope routines::unsupported @fiora/web: at new Hash (node:internal/crypto/hash:67:19) @fiora/web: at Object.createHash (node:crypto:130:10) @fiora/web: at BulkUpdateDecorator.hashFactory (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/util/createHash.js:145:18) @fiora/web: at BulkUpdateDecorator.update (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/util/createHash.js:46:50) @fiora/web: at RawSource.updateHash (/home/www/htdocs/fiora/packages/web/node_modules/webpack/node_modules/webpack-sources/lib/RawSource.js:64:8) @fiora/web: at NormalModule._initBuildHash (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:868:17) @fiora/web: at handleParseResult (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:934:10) @fiora/web: at /home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:1026:4 @fiora/web: at processResult (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:743:11) @fiora/web: at /home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:807:5 @fiora/web: node:internal/crypto/hash:67 @fiora/web: this[kHandle] = new _Hash(algorithm, xofLen); @fiora/web: ^ @fiora/web: Error: error:0308010C:digital envelope routines::unsupported @fiora/web: at new Hash (node:internal/crypto/hash:67:19) @fiora/web: at Object.createHash (node:crypto:130:10) @fiora/web: at BulkUpdateDecorator.hashFactory (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/util/createHash.js:145:18) @fiora/web: at BulkUpdateDecorator.update (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/util/createHash.js:46:50) @fiora/web: at RawSource.updateHash (/home/www/htdocs/fiora/packages/web/node_modules/webpack/node_modules/webpack-sources/lib/RawSource.js:64:8) @fiora/web: at NormalModule._initBuildHash (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:868:17) @fiora/web: at handleParseResult (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:934:10) @fiora/web: at /home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:1026:4 @fiora/web: at processResult (/home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:743:11) @fiora/web: at /home/www/htdocs/fiora/packages/web/node_modules/webpack/lib/NormalModule.js:807:5 { @fiora/web: opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], @fiora/web: library: 'digital envelope routines', @fiora/web: reason: 'unsupported', @fiora/web: code: 'ERR_OSSL_EVP_UNSUPPORTED' @fiora/web: } @fiora/web: Node.js v17.1.0
看不出来问题. 可以尝试下换到 Node.js v14, 重新安装依赖 rm -rf node_modules && yarn install
, 然后重试构建
切换到Node.js V14.15.0(14.0.0 yran报错)之后构建服务器代码仍报错,内容如下 lerna info Executing command in 1 package: "yarn run build:web" @fiora/web: warning package.json: "dependencies" has dependency "@testing-library/jest-dom" with range "^5.14.1" that collides with a dependency in "devDependencies" of the same name with version "^4.2.4" @fiora/web: $ rm -rf dist && cross-env NODE_ENV=production DOTENV_CONFIG_PATH=../../.env webpack --config build/webpack.prod.js && cp -r -f dist/fiora/* ../server/public @fiora/web: ℹ Compiling Webpack @fiora/web: error Command failed with exit code 1. @fiora/web: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. lerna ERR! yarn run build:web exited 1 in '@fiora/web' error Command failed with exit code 1.
warning package.json: "dependencies" has dependency "@testing-library/jest-dom" with range "^5.14.1" that collides with a dependency in "devDependencies" of the same name with version "^4.2.4" 报错啊
[root@VM-0-16-centos fiora]# yarn build:web
yarn run v1.22.18
$ npx lerna run build:web --stream
lerna notice cli v4.0.0
lerna info versioning independent
lerna info Executing command in 1 package: "yarn run build:web"
@fiora/web: warning package.json: "dependencies" has dependency "@testing-library/jest-dom" with range "^5.14.1" that collides with a dependency in "devDependencies" of the same name with version "^4.2.4"
@fiora/web: $ rm -rf dist && cross-env NODE_ENV=production DOTENV_CONFIG_PATH=../../.env webpack --config build/webpack.prod.js && cp -r -f dist/fiora/* ../server/public
@fiora/web: ℹ Compiling Webpack
@fiora/web: Browserslist: caniuse-lite is outdated. Please run:
@fiora/web: npx browserslist@latest --update-db
@fiora/web: Why you should do it regularly:
@fiora/web: https://github.com/browserslist/browserslist#browsers-data-updating
@fiora/web: ✔ Webpack: Compiled with some errors in 40.45s
@fiora/web: assets by status 5.24 MiB [cached] 83 assets
@fiora/web: orphan modules 1.13 MiB [orphan] 516 modules
@fiora/web: runtime modules 8.44 KiB 13 modules
@fiora/web: modules by path ./node_modules/ 6.27 MiB 828 modules
@fiora/web: modules by path ../ 68 KiB
@fiora/web: modules by path ../assets/ 3.02 KiB 50 modules
@fiora/web: modules by path ../utils/ 63.9 KiB 17 modules
@fiora/web: ../config/client.ts 1.12 KiB [built] [code generated]
@fiora/web: modules by path ./src/ 761 KiB 59 modules
@fiora/web: modules by path ./.linaria-cache/packages/web/src/ 6.83 KiB
@fiora/web: modules by path ./.linaria-cache/packages/web/src/modules/ 5.04 KiB 10 modules
@fiora/web: modules by path ./.linaria-cache/packages/web/src/.css 764 bytes 2 modules
@fiora/web: modules by path ./.linaria-cache/packages/web/src/components/.css 1.04 KiB
@fiora/web: ./.linaria-cache/packages/web/src/components/Button.linaria.css 359 bytes [built] [code generated]
@fiora/web: ./node_modules/css-loader/dist/cjs.js!./.linaria-cache/packages/web/src/components/Button.linaria.css 706 bytes [built] [code generated]
@fiora/web: LOG from GenerateSW
@fiora/web: The service worker at service-worker.js will precache
@fiora/web: 81 URLs, totaling 5.47 MB.
@fiora/web: ERROR in ./src/modules/Chat/Chat.less (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/modules/Chat/Chat.less)
@fiora/web: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
@fiora/web: Error: Can't resolve '~@fiora/assets/images/no-linkman.jpeg' in '/opt/fiora/packages/web/src/modules/Chat'
@fiora/web: at finishWithoutResolve (/opt/fiora/packages/web/node_modules/enhanced-resolve/lib/Resolver.js:293:18)
@fiora/web: at /opt/fiora/packages/web/node_modules/enhanced-resolve/lib/Resolver.js:362:15
@fiora/web: at /opt/fiora/packages/web/node_modules/enhanced-resolve/lib/Resolver.js:410:5
@fiora/web: at eval (eval at create (/opt/fiora/packages/web/node_modules/tapable/lib/HookCodeFactory.js:33:10),
找到错误原因了 Node.js 版本不对造成的 改成Node.js 14.16.1 成功!!!
找到错误原因了 Node.js 版本不对造成的 改成Node.js 14.16.1 成功!!!
我试了 14.16.1 也还是会报错
[root@fiora fiora]# yarn build:web
yarn run v1.22.19
$ npx lerna run build:web --stream
npx: installed 619 in 145.902s
lerna notice cli v5.1.6
lerna info versioning independent
lerna info Executing command in 1 package: "yarn run build:web"
(node:22844) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 2 error listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ...
to show where the warning was created)
@fiora/web: warning package.json: "dependencies" has dependency "@testing-library/jest-dom" with range "^5.14.1" that collides with a dependency in "devDependencies"of the same name with version "^4.2.4"
@fiora/web: $ rm -rf dist && cross-env NODE_ENV=production DOTENV_CONFIG_PATH=../../.env webpack --config build/webpack.prod.js && cp -r -f dist/fiora/* ../server/public
@fiora/web: /bin/sh: cross-env: command not found
@fiora/web: error Command failed with exit code 127.
@fiora/web: info Visit https://yarnpkg.com/en/docs/cli/run for documentation aboutthis command.
lerna ERR! yarn run build:web exited 127 in '@fiora/web'
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@9201314 切换版本后要重新安装依赖, yarn install
@9201314 切换版本后要重新安装依赖,
yarn install
我是重装服务器全新安装的 14.16.1 版本,试了两次都还是这样的问题
我这里 yarn install 报错的原因找到了,是没有 cd 到 fiora 目录下,yarn install 和 yarn build:web 命令一样都需要 cd 到 fiora 目录下。建议作者有空可以加上这一条,帮小白绕个坑……
正解
yarn run v1.22.19 $ npx lerna run build:web --stream lerna notice cli v4.0.0 lerna info versioning independent lerna info Executing command in 1 package: "yarn run build:web" @fiora/web: warning package.json: "dependencies" has dependency "@testing-library/jest-dom" with range "^5.14.1" that collides with a dependency in "devDependencies" of the same name with version "^4.2.4" @fiora/web: $ rm -rf dist && cross-env NODE_ENV=production DOTENV_CONFIG_PATH=../../.env webpack --config build/webpack.prod.js && cp -r -f dist/fiora/* ../server/public @fiora/web: 'rm' �����ڲ����ⲿ���Ҳ���ǿ����еij��� @fiora/web: ���������ļ��� @fiora/web: error Command failed with exit code 1. @fiora/web: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. lerna ERR! yarn run build:web exited 1 in '@fiora/web' error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
还是报错..