yinxin630 / fiora

An interesting open source chat application. Developed with node.js, mongoDB, socket.io and react
https://fiora.suisuijiang.com
MIT License
6.57k stars 1.31k forks source link

构建客户端代码时报错 #459

Open RailgunBreaker opened 2 years ago

RailgunBreaker commented 2 years ago

报错内容 @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. 请问如何解决

yinxin630 commented 2 years ago

这些信息没有用, 要看再往上面一些的内容是啥

RailgunBreaker commented 2 years ago

@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

yinxin630 commented 2 years ago

看不出来问题. 可以尝试下换到 Node.js v14, 重新安装依赖 rm -rf node_modules && yarn install, 然后重试构建

RailgunBreaker commented 2 years ago

切换到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.

YuHang-Kuo commented 2 years ago

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), :15:1) @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), :27:1) @fiora/web: at /opt/fiora/packages/web/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43 @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), :15:1) @fiora/web: at /opt/fiora/packages/web/node_modules/enhanced-resolve/lib/Resolver.js:410:5 @fiora/web: @ ./src/modules/Chat/Chat.less 2:12-195 9:17-24 13:15-29 @fiora/web: @ ./src/modules/Chat/Chat.tsx 47:0-32 236:17-27 242:17-27 249:17-32 251:17-37 253:17-36 305:15-25 @fiora/web: @ ./src/App.tsx 27:0-39 193:154-158 @fiora/web: @ ./src/main.tsx 197:0-24 252:36-39 @fiora/web: webpack 5.45.1 compiled with 1 error in 40459 ms @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.

YuHang-Kuo commented 2 years ago

找到错误原因了 Node.js 版本不对造成的 改成Node.js 14.16.1 成功!!!

9201314 commented 2 years ago

找到错误原因了 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.

yinxin630 commented 2 years ago

@9201314 切换版本后要重新安装依赖, yarn install

9201314 commented 2 years ago

@9201314 切换版本后要重新安装依赖, yarn install

我是重装服务器全新安装的 14.16.1 版本,试了两次都还是这样的问题

9201314 commented 2 years ago

我这里 yarn install 报错的原因找到了,是没有 cd 到 fiora 目录下,yarn install 和 yarn build:web 命令一样都需要 cd 到 fiora 目录下。建议作者有空可以加上这一条,帮小白绕个坑……

cancundeyingzi commented 1 year ago

正解

GengarQin commented 1 year ago

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.

还是报错..