vendure-ecommerce / vendure

The commerce platform with customization in its DNA.
https://www.vendure.io
Other
5.68k stars 1.01k forks source link

Installation fails with 'Illegal instruction' #1447

Closed rhclayto closed 2 years ago

rhclayto commented 2 years ago

Describe the bug Installation with npx fails with message 'Illegal instruction'. No other messages.

Setting up your new Vendure project in /opt/vendure
This may take a few minutes...

  ✔ Installing dependencies
  ⠙ Generating app scaffold
    Initializing server
Illegal instruction

To Reproduce Steps to reproduce the behavior:

  1. Run npx @vendure/create vendure.
  2. Answer questions in setup wizard.
  3. Wait.

Expected behavior Installation completes successfully.

Environment (please complete the following information):

Additional context I next tried installing from the git repository using the Development instructions from the Readme. At the step of populating the DB (tried PostgresQL, MySQl, SQlite) it also gives an Illegal Error. The end of running strace node -r ts-node/register populate-dev-server.ts shows:

openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/tls/x86_64/x86_64/libvips-cpp.so.42", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/tls/x86_64/x86_64", 0x7ffd78d01360) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/tls/x86_64/libvips-cpp.so.42", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/tls/x86_64", 0x7ffd78d01360) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/tls/x86_64/libvips-cpp.so.42", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/tls/x86_64", 0x7ffd78d01360) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/tls/libvips-cpp.so.42", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/tls", 0x7ffd78d01360) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/x86_64/x86_64/libvips-cpp.so.42", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/x86_64/x86_64", 0x7ffd78d01360) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/x86_64/libvips-cpp.so.42", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/x86_64", 0x7ffd78d01360) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/x86_64/libvips-cpp.so.42", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/x86_64", 0x7ffd78d01360) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/libvips-cpp.so.42", O_RDONLY|O_CLOEXEC) = 20
read(20, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0p\36\0\0\0\0\0"..., 832) = 832
fstat(20, {st_mode=S_IFREG|0644, st_size=18432544, ...}) = 0
mmap(NULL, 20676872, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 20, 0) = 0x7f4192c47000
mprotect(0x7f4192e2c000, 15151104, PROT_NONE) = 0
mmap(0x7f4192e2c000, 11190272, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x1e5000) = 0x7f4192e2c000
mmap(0x7f41938d8000, 3956736, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0xc91000) = 0x7f41938d8000
mmap(0x7f4193c9f000, 1298432, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x1057000) = 0x7f4193c9f000
mmap(0x7f4193ddc000, 2240776, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4193ddc000
close(20)                               = 0
openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/libresolv.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/libresolv.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 20
fstat(20, {st_mode=S_IFREG|0644, st_size=72892, ...}) = 0
mmap(NULL, 72892, PROT_READ, MAP_PRIVATE, 20, 0) = 0x7f41b110d000
close(20)                               = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 20
read(20, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 G\0\0\0\0\0\0"..., 832) = 832
fstat(20, {st_mode=S_IFREG|0644, st_size=101320, ...}) = 0
mmap(NULL, 113280, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 20, 0) = 0x7f41b10f1000
mprotect(0x7f41b10f5000, 81920, PROT_NONE) = 0
mmap(0x7f41b10f5000, 65536, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x4000) = 0x7f41b10f5000
mmap(0x7f41b1105000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x14000) = 0x7f41b1105000
mmap(0x7f41b1109000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x17000) = 0x7f41b1109000
mmap(0x7f41b110b000, 6784, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f41b110b000
close(20)                               = 0
mprotect(0x7f41b1109000, 4096, PROT_READ) = 0
mprotect(0x7f4193c9f000, 839680, PROT_READ) = 0
mprotect(0x7f41b1152000, 4096, PROT_READ) = 0
--- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPN, si_addr=0x7f4193139dfb} ---
+++ killed by SIGILL +++
Illegal instruction

Running it with gdb shows:

Thread 1 "node" received signal SIGILL, Illegal instruction.
0x00007fffd7139dfb in ?? ()
   from /opt/vendure/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-x64/lib/libvips-cpp.so.42

I have tried with node v14.17.1 & v16.13.2 (managed with n).

Edit: I removed the file /opt/vendure/node_modules/sharp/vendor/8.11.3/linux-x64/lib/libvips-cpp.so.42, & installed the package (Ubuntu 20.04) libvips-dev, & was able to get the following (note it used mysql even though I specified PostgreSQL):

root@skeletor:/opt/vendure/packages/dev-server# DB=postges yarn populate
yarn run v1.22.17
$ node -r ts-node/register populate-dev-server.ts
Using mysql connection
Clearing all tables...
Done!
info 2/28/22, 2:30 AM - [Vendure Server] Bootstrapping Vendure Server (pid: 2534356)...
info 2/28/22, 2:30 AM - [NestFactory] Starting Nest application...
info 2/28/22, 2:30 AM - [InstanceLoader] ProcessContextModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] ServiceModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] CacheModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] TypeOrmModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] PluginModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] PluginCommonModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] TypeOrmModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] HttpModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] ConfigModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] I18nModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] AssetServerPlugin dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] AdminUiPlugin dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] TerminusModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] BullMQJobQueuePlugin dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] JobQueueModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] AppModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] HealthCheckModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] TypeOrmCoreModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] ConnectionModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] ConnectionModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] ConnectionModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] EventBusModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] EmailPlugin dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] ApiSharedModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] DataImportModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] DefaultSearchPlugin dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] DefaultSearchPluginDynamicAdminModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] DefaultSearchPluginDynamicShopModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] ServiceCoreModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] ApiModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] AdminApiModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] ShopApiModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] GraphQLModule dependencies initialized
info 2/28/22, 2:30 AM - [InstanceLoader] GraphQLModule dependencies initialized
info 2/28/22, 2:30 AM - [AssetServerPlugin] Creating asset server middleware
info 2/28/22, 2:30 AM - [EmailPlugin] Creating dev mailbox middleware
info 2/28/22, 2:30 AM - [AdminUiPlugin] Creating admin ui middleware (prod mode)
verbose 2/28/22, 2:30 AM - [AdminUiPlugin] Checking for admin ui file: /opt/vendure/packages/admin-ui-plugin/lib/admin-ui/vendure-ui-config.json
verbose 2/28/22, 2:30 AM - [AdminUiPlugin] Applied configuration to vendure-ui-config.json file
verbose 2/28/22, 2:30 AM - [AdminUiPlugin] Checking for admin ui file: /opt/vendure/packages/admin-ui-plugin/lib/admin-ui/index.html
verbose 2/28/22, 2:30 AM - [AdminUiPlugin] Applied baseHref "/admin/" to index.html file
info 2/28/22, 2:30 AM - [RoutesResolver] HealthController {/health}:
info 2/28/22, 2:30 AM - [RouterExplorer] Mapped {/health, GET} route
info 2/28/22, 2:30 AM - [BullMQJobQueuePlugin] Checking Redis connection...
info 2/28/22, 2:30 AM - [BullMQJobQueuePlugin] Connected to Redis ✔
info 2/28/22, 2:30 AM - [NestApplication] Nest application successfully started
info 2/28/22, 2:30 AM - [Vendure Server] ================================================
info 2/28/22, 2:30 AM - [Vendure Server] Vendure server (v1.4.7) now running on port 3000
info 2/28/22, 2:30 AM - [Vendure Server] ------------------------------------------------
info 2/28/22, 2:30 AM - [Vendure Server] Shop API:     http://localhost:3000/shop-api
info 2/28/22, 2:30 AM - [Vendure Server] Admin API:    http://localhost:3000/admin-api
info 2/28/22, 2:30 AM - [Vendure Server] Asset server: http://localhost:3000/assets
info 2/28/22, 2:30 AM - [Vendure Server] Dev mailbox:  http://localhost:3000/mailbox
info 2/28/22, 2:30 AM - [Vendure Server] Admin UI:     http://localhost:3000/admin
info 2/28/22, 2:30 AM - [Vendure Server] ================================================
info 2/28/22, 2:30 AM - [JobQueue] Starting queue: apply-collection-filters
info 2/28/22, 2:30 AM - [JobQueue] Starting queue: send-email
info 2/28/22, 2:30 AM - [JobQueue] Starting queue: update-search-index
Populated initial data
munmap_chunk(): invalid pointer
Aborted
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

With gdb:

munmap_chunk(): invalid pointer

Thread 9 "node" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffd212f700 (LWP 2537061)]
0x00007ffff7a9218b in raise () from /lib/x86_64-linux-gnu/libc.so.6
michaelbromley commented 2 years ago

Hi, could your issue be related to this? https://github.com/lovell/sharp/issues/3030

rhclayto commented 2 years ago

Hi, could your issue be related to this? lovell/sharp#3030

It looks to be so. This machine has an AMD CPU from 2011 that lacks some of the pre-built sharp binaries' needed CPU features. So I won't be able to use the npx @vendure/create vendure deployment method. Bummer that an image-processing library should be such a problem. Thanks for pointing me to the problem.

rhclayto commented 2 years ago

Update: I was able to use npx @vendure/create vendure to install Vendure. The package of libvips-dev in Ubuntu repository was too old for the current version of sharp, so it was ignored. I built & installed the latest libvips from source, & sharp recognized & used it when installed via vendure-create. Tip from: https://sharp.pixelplumbing.com/install#custom-libvips

So this is doable for those of us toiling away on older hardware. Thanks again for helping to isolate the problem.