There are tons of errors below when using Knex.js in Webpack 5:
ERROR in ./node_modules/knex/lib/builder-interface-augmenter.js 3:24-39 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/query/querybuilder.js 30:4-45 @ ./node_modules/knex/lib/knex-builder/Knex.js 2:21-53 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/client.js 3:22-37 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/knex-builder/Knex.js 1:15-35 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/dialects/mysql/index.js 5:22-37 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib/dialects/mysql' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/dialects/ sync ^\.\/.*\/index\.js$ ./mysql/index.js @ ./node_modules/knex/lib/knex-builder/internal/config-resolver.js 40:14-70 @ ./node_modules/knex/lib/knex-builder/Knex.js 7:26-63 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/dialects/oracle/utils.js 2:17-34 Module not found: Error: Can't resolve 'crypto' in '/var/www/html/xxx/node_modules/knex/lib/dialects/oracle' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false } @ ./node_modules/knex/lib/dialects/oracle/index.js 3:28-46 4:30-48 @ ./node_modules/knex/lib/dialects/ sync ^\.\/.*\/index\.js$ ./oracle/index.js @ ./node_modules/knex/lib/knex-builder/internal/config-resolver.js 40:14-70 @ ./node_modules/knex/lib/knex-builder/Knex.js 7:26-63 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/dialects/oracledb/index.js 3:22-37 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib/dialects/oracledb' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/dialects/ sync ^\.\/.*\/index\.js$ ./oracledb/index.js @ ./node_modules/knex/lib/knex-builder/internal/config-resolver.js 40:14-70 @ ./node_modules/knex/lib/knex-builder/Knex.js 7:26-63 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/dialects/oracledb/index.js 4:15-32 Module not found: Error: Can't resolve 'stream' in '/var/www/html/xxx/node_modules/knex/lib/dialects/oracledb' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }' - install 'stream-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "stream": false } @ ./node_modules/knex/lib/dialects/ sync ^\.\/.*\/index\.js$ ./oracledb/index.js @ ./node_modules/knex/lib/knex-builder/internal/config-resolver.js 40:14-70 @ ./node_modules/knex/lib/knex-builder/Knex.js 7:26-63 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/dialects/postgres/index.js 5:22-37 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib/dialects/postgres' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/dialects/ sync ^\.\/.*\/index\.js$ ./postgres/index.js @ ./node_modules/knex/lib/knex-builder/internal/config-resolver.js 40:14-70 @ ./node_modules/knex/lib/knex-builder/Knex.js 7:26-63 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/dialects/sqlite3/index.js 5:22-37 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib/dialects/sqlite3' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/dialects/ sync ^\.\/.*\/index\.js$ ./sqlite3/index.js @ ./node_modules/knex/lib/knex-builder/internal/config-resolver.js 40:14-70 @ ./node_modules/knex/lib/knex-builder/Knex.js 7:26-63 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/execution/runner.js 61:29-56 Module not found: Error: Can't resolve 'stream' in '/var/www/html/xxx/node_modules/knex/lib/execution' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }' - install 'stream-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "stream": false } @ ./node_modules/knex/lib/client.js 9:15-44 @ ./node_modules/knex/lib/knex-builder/Knex.js 1:15-35 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/execution/transaction.js 6:24-39 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib/execution' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/client.js 10:20-54 @ ./node_modules/knex/lib/knex-builder/Knex.js 1:15-35 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/logger.js 2:20-35 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/client.js 29:15-34 @ ./node_modules/knex/lib/knex-builder/Knex.js 1:15-35 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/migrations/migrate/MigrationGenerator.js 1:13-28 Module not found: Error: Can't resolve 'path' in '/var/www/html/xxx/node_modules/knex/lib/migrations/migrate' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } @ ./node_modules/knex/lib/migrations/migrate/Migrator.js 15:27-58 @ ./node_modules/knex/lib/knex-builder/make-knex.js 3:21-62 @ ./node_modules/knex/lib/knex-builder/Knex.js 5:17-39 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/migrations/migrate/Migrator.js 7:21-36 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib/migrations/migrate' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/knex-builder/make-knex.js 3:21-62 @ ./node_modules/knex/lib/knex-builder/Knex.js 5:17-39 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/migrations/migrate/sources/fs-migrations.js 1:13-28 Module not found: Error: Can't resolve 'path' in '/var/www/html/xxx/node_modules/knex/lib/migrations/migrate/sources' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } @ ./node_modules/knex/lib/migrations/migrate/configuration-merger.js 4:4-38 @ ./node_modules/knex/lib/migrations/migrate/Migrator.js 16:28-61 @ ./node_modules/knex/lib/knex-builder/make-knex.js 3:21-62 @ ./node_modules/knex/lib/knex-builder/Knex.js 5:17-39 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/migrations/seed/Seeder.js 4:13-28 Module not found: Error: Can't resolve 'path' in '/var/www/html/xxx/node_modules/knex/lib/migrations/seed' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } @ ./node_modules/knex/lib/knex-builder/make-knex.js 4:15-51 @ ./node_modules/knex/lib/knex-builder/Knex.js 5:17-39 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/migrations/util/fs.js 1:11-24 Module not found: Error: Can't resolve 'fs' in '/var/www/html/xxx/node_modules/knex/lib/migrations/util' @ ./node_modules/knex/lib/migrations/seed/Seeder.js 8:56-77 @ ./node_modules/knex/lib/knex-builder/make-knex.js 4:15-51 @ ./node_modules/knex/lib/knex-builder/Knex.js 5:17-39 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/migrations/util/fs.js 3:11-24 Module not found: Error: Can't resolve 'os' in '/var/www/html/xxx/node_modules/knex/lib/migrations/util' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }' - install 'os-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "os": false } @ ./node_modules/knex/lib/migrations/seed/Seeder.js 8:56-77 @ ./node_modules/knex/lib/knex-builder/make-knex.js 4:15-51 @ ./node_modules/knex/lib/knex-builder/Knex.js 5:17-39 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/migrations/util/fs.js 4:13-28 Module not found: Error: Can't resolve 'path' in '/var/www/html/xxx/node_modules/knex/lib/migrations/util' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } @ ./node_modules/knex/lib/migrations/seed/Seeder.js 8:56-77 @ ./node_modules/knex/lib/knex-builder/make-knex.js 4:15-51 @ ./node_modules/knex/lib/knex-builder/Knex.js 5:17-39 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/migrations/util/fs.js 5:22-37 Module not found: Error: Can't resolve 'util' in '/var/www/html/xxx/node_modules/knex/lib/migrations/util' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } @ ./node_modules/knex/lib/migrations/seed/Seeder.js 8:56-77 @ ./node_modules/knex/lib/knex-builder/make-knex.js 4:15-51 @ ./node_modules/knex/lib/knex-builder/Knex.js 5:17-39 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/query/analytic.js 1:15-32 Module not found: Error: Can't resolve 'assert' in '/var/www/html/xxx/node_modules/knex/lib/query' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false } @ ./node_modules/knex/lib/query/querybuilder.js 17:17-38 @ ./node_modules/knex/lib/knex-builder/Knex.js 2:21-53 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/query/joinclause.js 1:15-32 Module not found: Error: Can't resolve 'assert' in '/var/www/html/xxx/node_modules/knex/lib/query' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false } @ ./node_modules/knex/lib/query/querybuilder.js 16:19-42 @ ./node_modules/knex/lib/knex-builder/Knex.js 2:21-53 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/knex/lib/query/querybuilder.js 3:15-32 Module not found: Error: Can't resolve 'assert' in '/var/www/html/xxx/node_modules/knex/lib/query' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false } @ ./node_modules/knex/lib/knex-builder/Knex.js 2:21-53 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/pg-connection-string/index.js 4:9-22 Module not found: Error: Can't resolve 'fs' in '/var/www/html/xxx/node_modules/pg-connection-string' @ ./node_modules/knex/lib/knex-builder/internal/parse-connection.js 1:18-49 @ ./node_modules/knex/lib/knex-builder/internal/config-resolver.js 4:24-53 @ ./node_modules/knex/lib/knex-builder/Knex.js 7:26-63 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 ERROR in ./node_modules/tarn/dist/Pool.js 7:17-34 Module not found: Error: Can't resolve 'timers' in '/var/www/html/xxx/node_modules/tarn/dist' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "timers": require.resolve("timers-browserify") }' - install 'timers-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "timers": false } @ ./node_modules/tarn/dist/tarn.js 3:15-32 @ ./node_modules/knex/lib/client.js 1:31-46 @ ./node_modules/knex/lib/knex-builder/Knex.js 1:15-35 @ ./node_modules/knex/lib/index.js 1:13-43 @ ./node_modules/knex/knex.js 8:13-35 @ ./src/main-vanilla.js 34:11-26 24 errors have detailed information that is not shown. Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it. webpack 5.21.2 compiled with 24 errors and 2 warnings in 8772 ms ℹ 「wdm」: Failed to compile.
Any ideas how to resolve this? Do we need to install every 'missing stuff' like timers-browserify?
https://stackoverflow.com/questions/67443715/errors-from-knex-js-with-webpack-5 May 08, 2021 at 11:08AM
没有评论:
发表评论