bytedance / danmu.js

HTML5 danmu (danmaku) plugin for any DOM element
MIT License
290 stars 34 forks source link

Errors occurred while running "npm run build" #25

Closed connLAN closed 8 months ago

connLAN commented 12 months ago

Issue with danmu.js build process

Dear authors,

I am writing to report an issue that I encountered while trying to build danmu.js. I am using the latest version of the code from the GitHub repository, and I followed the instructions in the README.md file to install the dependencies and run the build process.

However, when I run the "npm run build" command, I receive an error message that prevents the build process from completing successfully. The error message is as follows:

npm run build

danmu.js@1.1.13 build node ./src/version.js && webpack --progress --display-chunks -p

10% [0] building 0/1 modules 1 active ...abel-loader/lib/index.js??ref--4!/home/user0/danmu.js/src/index.js/home/user0/danmu.js/node_modules/babel-loader/lib/cache.js:22 const findCacheDirP = import("find-cache-dir"); ^

TypeError: Invalid host defined options at Object. (/home/user0/danmu.js/node_modules/babel-loader/lib/cache.js:22:23) at Module._compile (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Module.require (node:internal/modules/cjs/loader:1143:19) at require (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) at Object. (/home/user0/danmu.js/node_modules/babel-loader/lib/index.js:19:15) at Module._compile (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Module.require (node:internal/modules/cjs/loader:1143:19) at require (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) at loadLoader (/home/user0/danmu.js/node_modules/loader-runner/lib/loadLoader.js:18:17) at iteratePitchingLoaders (/home/user0/danmu.js/node_modules/loader-runner/lib/LoaderRunner.js:169:2) at runLoaders (/home/user0/danmu.js/node_modules/loader-runner/lib/LoaderRunner.js:365:2) at NormalModule.doBuild (/home/user0/danmu.js/node_modules/webpack/lib/NormalModule.js:295:3) at NormalModule.build (/home/user0/danmu.js/node_modules/webpack/lib/NormalModule.js:446:15) at Compilation.buildModule (/home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:739:10) at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1111:12 at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:409:6 at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:155:13 at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), :6:1) at AsyncSeriesWaterfallHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20) at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:138:29 at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:346:9 at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

Node.js v18.17.1

I have tried several solutions to resolve this issue, including checking my Node.js and OpenSSL versions, verifying my dependencies, and reviewing my webpack and babel-loader configurations. However, none of these solutions have worked.

I would appreciate any assistance you can provide in resolving this issue. Please let me know if you need any additional information or if there is anything else I can do to help diagnose the problem.

Thank you for your time and attention.

Sincerely,

gemxx commented 12 months ago

try use yarn to install node_module packages,

gemxx commented 12 months ago

I have updated the development documentation and reinstalled npm package.

yarn 
yarn build 
yarn serve 

visit: http://localhost:3000/demo/index.html

connLAN commented 12 months ago

I have updated the development documentation and reinstalled npm package.

yarn 
yarn build 
yarn serve 

visit: http://localhost:3000/demo/index.html

It seems that I need more help, :) OS: fedora latest.

yarn yarn install v1.22.19 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... warning webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2 [2/4] Fetching packages... [3/4] Linking dependencies... warning " > babel-loader@9.1.3" has unmet peer dependency "@babel/core@^7.12.0". warning " > babel-loader@9.1.3" has incorrect peer dependency "webpack@>=5". warning " > css-loader@6.8.1" has incorrect peer dependency "webpack@^5.0.0". warning " > postcss-cssnext@3.1.1" has unmet peer dependency "caniuse-lite@^1.0.30000697". warning " > postcss-loader@7.3.3" has unmet peer dependency "postcss@^7.0.0 || ^8.0.1". warning " > postcss-loader@7.3.3" has incorrect peer dependency "webpack@^5.0.0". [4/4] Building fresh packages... success Saved lockfile. Done in 60.08s. [user0@fedora danmu.js]$ yarn install yarn install v1.22.19 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... success Already up-to-date. Done in 1.84s. [user0@fedora danmu.js]$ yarn build yarn run v1.22.19 $ node ./src/version.js && webpack --progress --display-chunks -p Hash: 1e86eaf824e84684fe69f71c7c4b21a6ffbe5a9a Version: webpack 4.47.0 Child Hash: 1e86eaf824e84684fe69 Time: 323ms Built at: 09/15/2023 3:45:30 PM 2 assets Entrypoint main = index.js index.js.map chunk {0} index.js, index.js.map (main) 3.15 KiB [entry] [rendered] [0] ./src/index.js 3.15 KiB {0} [not cacheable] [built] [failed] [1 error]

ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/core'
Require stack:
- /home/user0/danmu.js/node_modules/babel-loader/lib/index.js
- /home/user0/danmu.js/node_modules/loader-runner/lib/loadLoader.js
- /home/user0/danmu.js/node_modules/loader-runner/lib/LoaderRunner.js
- /home/user0/danmu.js/node_modules/webpack/lib/NormalModule.js
- /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js
- /home/user0/danmu.js/node_modules/webpack/lib/Compiler.js
- /home/user0/danmu.js/node_modules/webpack/lib/webpack.js
- /home/user0/danmu.js/node_modules/webpack-cli/bin/utils/validate-options.js
- /home/user0/danmu.js/node_modules/webpack-cli/bin/utils/convert-argv.js
- /home/user0/danmu.js/node_modules/webpack-cli/bin/cli.js
- /home/user0/danmu.js/node_modules/webpack/bin/webpack.js
 babel-loader@9 requires Babel 7.12+ (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/user0/danmu.js/node_modules/babel-loader/lib/index.js:3:11)
    at Module._compile (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at loadLoader (/home/user0/danmu.js/node_modules/loader-runner/lib/loadLoader.js:18:17)
    at iteratePitchingLoaders (/home/user0/danmu.js/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/user0/danmu.js/node_modules/loader-runner/lib/LoaderRunner.js:365:2)
    at NormalModule.doBuild (/home/user0/danmu.js/node_modules/webpack/lib/NormalModule.js:295:3)
    at NormalModule.build (/home/user0/danmu.js/node_modules/webpack/lib/NormalModule.js:446:15)
    at Compilation.buildModule (/home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:739:10)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1111:12
    at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:409:6
    at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:155:13
    at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesWaterfallHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:138:29
    at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:346:9
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

ERROR in index.js from Terser
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at /home/user0/danmu.js/node_modules/terser-webpack-plugin/dist/index.js:217:37
    at Array.forEach (<anonymous>)
    at TerserPlugin.optimizeFn (/home/user0/danmu.js/node_modules/terser-webpack-plugin/dist/index.js:160:259)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1409:36
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1405:32
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.seal (/home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1342:27)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compiler.js:675:18
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1261:4
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.finish (/home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1253:28)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compiler.js:672:17
    at eval (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1185:12
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1097:9
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

Child Hash: f71c7c4b21a6ffbe5a9a Time: 308ms Built at: 09/15/2023 3:45:30 PM 2 assets Entrypoint main = index.js index.js.map chunk {0} index.js, index.js.map (main) 3.15 KiB [entry] [rendered] [0] ./src/index.js 3.15 KiB {0} [not cacheable] [built] [failed] [1 error]

ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/core'
Require stack:
- /home/user0/danmu.js/node_modules/babel-loader/lib/index.js
- /home/user0/danmu.js/node_modules/loader-runner/lib/loadLoader.js
- /home/user0/danmu.js/node_modules/loader-runner/lib/LoaderRunner.js
- /home/user0/danmu.js/node_modules/webpack/lib/NormalModule.js
- /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js
- /home/user0/danmu.js/node_modules/webpack/lib/Compiler.js
- /home/user0/danmu.js/node_modules/webpack/lib/webpack.js
- /home/user0/danmu.js/node_modules/webpack-cli/bin/utils/validate-options.js
- /home/user0/danmu.js/node_modules/webpack-cli/bin/utils/convert-argv.js
- /home/user0/danmu.js/node_modules/webpack-cli/bin/cli.js
- /home/user0/danmu.js/node_modules/webpack/bin/webpack.js
 babel-loader@9 requires Babel 7.12+ (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/user0/danmu.js/node_modules/babel-loader/lib/index.js:3:11)
    at Module._compile (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (/home/user0/danmu.js/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at loadLoader (/home/user0/danmu.js/node_modules/loader-runner/lib/loadLoader.js:18:17)
    at iteratePitchingLoaders (/home/user0/danmu.js/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/user0/danmu.js/node_modules/loader-runner/lib/LoaderRunner.js:365:2)
    at NormalModule.doBuild (/home/user0/danmu.js/node_modules/webpack/lib/NormalModule.js:295:3)
    at NormalModule.build (/home/user0/danmu.js/node_modules/webpack/lib/NormalModule.js:446:15)
    at Compilation.buildModule (/home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:739:10)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1111:12
    at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:409:6
    at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:155:13
    at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesWaterfallHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:138:29
    at /home/user0/danmu.js/node_modules/webpack/lib/NormalModuleFactory.js:346:9
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

ERROR in index.js from Terser
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at /home/user0/danmu.js/node_modules/terser-webpack-plugin/dist/index.js:217:37
    at Array.forEach (<anonymous>)
    at TerserPlugin.optimizeFn (/home/user0/danmu.js/node_modules/terser-webpack-plugin/dist/index.js:160:259)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1409:36
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1405:32
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.seal (/home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1342:27)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compiler.js:675:18
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1261:4
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user0/danmu.js/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.finish (/home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1253:28)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compiler.js:672:17
    at eval (eval at create (/home/user0/danmu.js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1185:12
    at /home/user0/danmu.js/node_modules/webpack/lib/Compilation.js:1097:9
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

error Command failed with exit code 2.

connLAN commented 12 months ago

I tried it again, after remove yarn.lock, it is fine to run "yarn && yarn install", but "yarn serve" not work for "serve" doesn't exists in package.json. I will glad to hear that you fixed it, best regards.

gemxx commented 12 months ago

which npm version & node version are you using?

connLAN commented 12 months ago

[tiny@fedora ~]$ node --version v18.17.1 [tiny@fedora ~]$ npm --version 10.1.0 [tiny@fedora ~]$ uname -a Linux fedora 6.4.14-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Sep 2 16:36:06 UTC 2023 x86_64 GNU/Linux

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 8 months ago

This issue has been automatically closed after a period of inactivity. If it is still present in the latest release, please create a new issue with up-to-date information. Thank you!