Unable to install

System Information
  • Strapi Version: 4.5.4
  • Operating System: Ubuntu 22.04.1 LTS
  • Database: sqlite
  • Node Version: 18.12.1
  • NPM Version: 8.19.2
  • Yarn Version: 1.22.19

I can’t install strapi v4. These are the error messages:

yarn install v1.22.19
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning @strapi/strapi > koa-session > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning @strapi/strapi > koa-body > formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
warning @strapi/strapi > @strapi/admin > react-router > mini-create-react-context@0.4.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
warning @strapi/strapi > @strapi/admin > node-polyfill-webpack-plugin > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer@3.12.0: This project is unmaintained
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer > buildmail@3.10.0: This project is unmaintained
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning @strapi/plugin-users-permissions > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning @strapi/plugin-users-permissions > request > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning @strapi/plugin-users-permissions > request > har-validator@5.1.5: this library is no longer supported
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.5.4" has unmet peer dependency "webpack@^5.74.0".
warning "@strapi/strapi > @strapi/plugin-upload > @strapi/helper-plugin > react-select > @emotion/react > @emotion/babel-plugin@11.10.5" has unmet peer dependency "@babel/core@^7.0.0".
[5/5] Building fresh packages...
[12/12] ⡀ better-sqlite3
[-/12] ⡀ waiting...
[-/12] ⡀ waiting...
[-/12] ⡀ waiting...
error /var/www/strapi/node_modules/better-sqlite3: Command failed.
Exit code: 1
Command: prebuild-install || npm run build-release
Arguments:
Directory: /var/www/strapi/node_modules/better-sqlite3
Output:
prebuild-install warn install No prebuilt binaries found (target=18.12.1 runtime=node arch=x64 libc= platform=linux)

> better-sqlite3@7.4.6 build-release
> node-gyp rebuild --release

gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@18.12.1 | linux | x64
gyp info find Python using Python version 3.10.6 found at "/usr/bin/python3"
gyp http GET https://nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v18.12.1/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v18.12.1/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/var/www/strapi/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.cache/node-gyp/18.12.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/18.12.1',
gyp info spawn args   '-Dnode_gyp_dir=/root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/18.12.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/var/www/strapi/node_modules/better-sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/which/which.js:10:17)
gyp ERR! stack     at /root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/which/which.js:57:18
gyp ERR! stack     at new Promise (<anonymous>)
gyp ERR! stack     at step (/root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/which/which.js:54:21)
gyp ERR! stack     at /root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/which/which.js:71:22
gyp ERR! stack     at new Promise (<anonymous>)
gyp ERR! stack     at subStep (/root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/which/which.js:69:33)
gyp ERR! stack     at /root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/which/which.js:80:22
gyp ERR! stack     at /root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! System Linux 5.15.0-52-generic
gyp ERR! command "/root/.nvm/versions/node/v18.12.1/bin/node" "/root/.nvm/versions/node/v18.12.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /var/www/strapi/node_modules/better-sqlite3

Could solve the problem. After the following command the installation was working.

$ sudo apt install build-essential

Now the next error. I can’t get it to work. The installation is complicated.
After running yarn build i get this errors (Progress 87% Webpack sealing).

Before running this command i called https://mydomain:1337/admin and i see:

Warning: An error occurred while requesting the API

[1519098:0x578e260]   198533 ms: Scavenge (reduce) 250.1 (258.0) -> 249.9 (258.5) MB, 928.1 / 0.0 ms  (average mu = 0.686, current mu = 0.672) allocation failure;
[1519098:0x578e260]   204033 ms: Mark-sweep (reduce) 250.7 (258.5) -> 250.1 (259.0) MB, 5235.8 / 0.0 ms  (+ 437.3 ms in 18 steps since start of marking, biggest step 99.0 ms, walltime since start of marking 6970 ms) (average mu = 0.579, current mu = 0.475

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb6e500 node::Abort() [/root/.nvm/versions/node/v18.12.1/bin/node]
 2: 0xa7e632  [/root/.nvm/versions/node/v18.12.1/bin/node]
 3: 0xd47f20 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/root/.nvm/versions/node/v18.12.1/bin/node]
 4: 0xd482c7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/root/.nvm/versions/node/v18.12.1/bin/node]
 5: 0xf25685  [/root/.nvm/versions/node/v18.12.1/bin/node]
 6: 0xf37b6d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/root/.nvm/versions/node/v18.12.1/bin/node]
 7: 0xf1226e v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/root/.nvm/versions/node/v18.12.1/bin/node]
 8: 0xf13637 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/root/.nvm/versions/node/v18.12.1/bin/node]
 9: 0xef480a v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/root/.nvm/versions/node/v18.12.1/bin/node]
10: 0x12b7daf v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/root/.nvm/versions/node/v18.12.1/bin/node]
11: 0x16e99f9  [/root/.nvm/versions/node/v18.12.1/bin/node]
Aborted
error Command failed with exit code 134.