strapi / nextjs-corporate-starter

Strapi Demo application for Corporate Websites using Next.js
MIT License
1.08k stars 338 forks source link

better_sqlite3.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 93. This version of Node.js requires NODE_MODULE_VERSION 108. #66

Closed stevennt closed 1 year ago

stevennt commented 1 year ago

I got this error while importing data:

yarn strapi import -f ../seed-data.tar.gz yarn run v1.22.19 warning ../../../../../package.json: No license field $ strapi import -f ../seed-data.tar.gz ? The import will delete all assets and data in your database. Are you sure you want to proceed? Yes This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason: Error: The module '/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/better-sqlite3/build/Release/better_sqlite3.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 93. This version of Node.js requires NODE_MODULE_VERSION 108. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install). at Module._extensions..node (node:internal/modules/cjs/loader:1189:18) at Module.load (node:internal/modules/cjs/loader:981:32) at Module._load (node:internal/modules/cjs/loader:827:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at bindings (/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/bindings/bindings.js:112:48) at new Database (/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/better-sqlite3/lib/database.js:48:64) at Client_BetterSQLite3.acquireRawConnection (/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/knex/lib/dialects/better-sqlite3/index.js:12:12) at create (/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/knex/lib/client.js:254:39) Error: The module '/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/better-sqlite3/build/Release/better_sqlite3.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 93. This version of Node.js requires NODE_MODULE_VERSION 108. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install). at Module._extensions..node (node:internal/modules/cjs/loader:1189:18) at Module.load (node:internal/modules/cjs/loader:981:32) at Module._load (node:internal/modules/cjs/loader:827:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at bindings (/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/bindings/bindings.js:112:48) at new Database (/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/better-sqlite3/lib/database.js:48:64) at Client_BetterSQLite3.acquireRawConnection (/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/knex/lib/dialects/better-sqlite3/index.js:12:12) at create (/home/thanhson/Downloads/tmp/strapi/nextjs-corporate-starter/backend/node_modules/knex/lib/client.js:254:39) { code: 'ERR_DLOPEN_FAILED' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

stevennt commented 1 year ago

And if I continue to the frontend part, setting the .env and run yarn dev, I get the following error:

event compiled client and server successfully in 4.1s (649 modules) (node:1528142) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time (Usenode --trace-warnings ...` to show where the warning was created) TypeError: fetch failed at Object.processResponse (node:internal/deps/undici/undici:5575:34) at node:internal/deps/undici/undici:5901:42 at node:internal/process/task_queues:140:7 at AsyncResource.runInAsyncScope (node:async_hooks:202:9) at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { cause: Error: connect ECONNREFUSED ::1:1337 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16) at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 1337 } } TypeError: fetch failed at Object.processResponse (node:internal/deps/undici/undici:5575:34) at node:internal/deps/undici/undici:5901:42 at node:internal/process/task_queues:140:7 at AsyncResource.runInAsyncScope (node:async_hooks:202:9) at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { cause: Error: connect ECONNREFUSED ::1:1337 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16) at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 1337 } } TypeError: fetch failed at Object.processResponse (node:internal/deps/undici/undici:5575:34) at node:internal/deps/undici/undici:5901:42 at node:internal/process/task_queues:140:7 at AsyncResource.runInAsyncScope (node:async_hooks:202:9) at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { cause: Error: connect ECONNREFUSED ::1:1337 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16) at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 1337 } }

austin047 commented 1 year ago

You might have to switch to node version 14.* in other to run the seed command.

PaulBratslavsky commented 1 year ago

@stevennt yes and thank you @austin047 make sure you are using at least node 14.19.1 but I would recommend switching to 16.

Let me know if you still have issues.