strapi/nextjs-corporate-starter

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.

stevennt opened this issue · 3 comments

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.

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
}
}

  • error src/app/[lang]/utils/fetch-api.tsx (32:10) @ fetchAPI
  • error Error: Please check if your server is running and you set all the required tokens.
    at fetchAPI (./src/app/[lang]/utils/fetch-api.tsx:31:15)
    at async getGlobal (./src/app/[lang]/layout.tsx:49:12)
    at async RootLayout (./src/app/[lang]/layout.tsx:67:20)
    30 | } catch (error) {
    31 | console.error(error);

32 | throw new Error(Please check if your server is running and you set all the required tokens.);
| ^
33 | }
34 | }
35 |

  • error src/app/[lang]/utils/fetch-api.tsx (32:10) @ fetchAPI
  • error Error: Please check if your server is running and you set all the required tokens.
    at fetchAPI (./src/app/[lang]/utils/fetch-api.tsx:31:15)
    at async getGlobal (./src/app/[lang]/layout.tsx:49:12)
    at async Module.generateMetadata (./src/app/[lang]/layout.tsx:52:18)
    30 | } catch (error) {
    31 | console.error(error);

32 | throw new Error(Please check if your server is running and you set all the required tokens.);
| ^
33 | }
34 | }
35 |

  • error src/app/[lang]/utils/fetch-api.tsx (32:10) @ fetchAPI
  • error Error: Please check if your server is running and you set all the required tokens.
    at fetchAPI (./src/app/[lang]/utils/fetch-api.tsx:31:15)
    at async getGlobal (./src/app/[lang]/layout.tsx:49:12)
    at async RootLayout (./src/app/[lang]/layout.tsx:67:20)
    digest: "781504476"
    30 | } catch (error) {
    31 | console.error(error);

32 | throw new Error(Please check if your server is running and you set all the required tokens.);
| ^
33 | }
34 | }
35 |

  • error src/app/[lang]/utils/fetch-api.tsx (32:10) @ fetchAPI
  • error Error: Please check if your server is running and you set all the required tokens.
    at fetchAPI (./src/app/[lang]/utils/fetch-api.tsx:31:15)
    at async getGlobal (./src/app/[lang]/layout.tsx:49:12)
    at async Module.generateMetadata (./src/app/[lang]/layout.tsx:52:18)
    digest: "4226281183"
    30 | } catch (error) {
    31 | console.error(error);

32 | throw new Error(Please check if your server is running and you set all the required tokens.);
| ^
33 | }
34 | }
`

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

@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.