Closed Qambar closed 2 years ago
I have installed it correctly using the macos-m1 package.
]
$ yarn run package:macos-m1
yarn run v1.22.10
$ pkg . --targets node14-macos-arm64 --output bin/macos/metaplex
> pkg@5.3.1
> Warning Failed to make bytecode node14-arm64 for file /snapshot/js/node_modules/react-native-fetch-api/fetch.js
prebuild-install WARN install No prebuilt binaries found (target=v14.17.2 runtime=node arch=arm64 libc= platform=darwin)
> Warning Failed to make bytecode node14-arm64 for file /snapshot/js/node_modules/react-native-fetch-api/src/Body.js
> Warning Failed to make bytecode node14-arm64 for file /snapshot/js/node_modules/react-native-fetch-api/src/Fetch.js
> Warning Failed to make bytecode node14-arm64 for file /snapshot/js/node_modules/react-native-fetch-api/src/Headers.js
> Warning Failed to make bytecode node14-arm64 for file /snapshot/js/node_modules/react-native-fetch-api/src/Request.js
> Warning Failed to make bytecode node14-arm64 for file /snapshot/js/node_modules/react-native-fetch-api/src/Response.js
> Warning Failed to make bytecode node14-arm64 for file /snapshot/js/node_modules/react-native-fetch-api/src/StreamArrayBufferResponse.js
> Warning Failed to make bytecode node14-arm64 for file /snapshot/js/node_modules/react-native-fetch-api/src/StreamBlobResponse.js
> Warning Failed to make bytecode node14-arm64 for file /snapshot/js/node_modules/react-native-fetch-api/src/utils.js
✨ Done in 19.99s.
(base)
But as soon as I run the metaplex command it throws the following exception:
$ ./bin/macos/metaplex
pkg/prelude/bootstrap.js:1697
throw error;
^
Error: dlopen(/var/folders/f_/ll33dc315ldc738pbth9339m0000gp/T/8eb7bd0516654c7bf3e2d99959b4166cc3c7cfc31e647d23d51a23475f407d8a/canvas.node, 1): no suitable image found. Did find:
/var/folders/f_/ll33dc315ldc738pbth9339m0000gp/T/8eb7bd0516654c7bf3e2d99959b4166cc3c7cfc31e647d23d51a23475f407d8a/canvas.node: mach-o, but wrong architecture
/private/var/folders/f_/ll33dc315ldc738pbth9339m0000gp/T/8eb7bd0516654c7bf3e2d99959b4166cc3c7cfc31e647d23d51a23475f407d8a/canvas.node: mach-o, but wrong architecture
at tryImporting (pkg/prelude/bootstrap.js:2028:37)
at tryImporting (pkg/prelude/bootstrap.js:2080:16)
at process.dlopen (pkg/prelude/bootstrap.js:2103:7)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at Module.require (pkg/prelude/bootstrap.js:1676:31)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/snapshot/js/node_modules/canvas/lib/bindings.js:3:18)
(base)
Try runningbrew install
on the following packages:
pixman, cairo and pango
The actual error is canvas.node: mach-o, but wrong architecture
installing those packages didn't help. still getting the same error:
pkg/prelude/bootstrap.js:1697
throw error;
^
Error: dlopen(/var/folders/f_/ll33dc315ldc738pbth9339m0000gp/T/8eb7bd0516654c7bf3e2d99959b4166cc3c7cfc31e647d23d51a23475f407d8a/canvas.node, 1): no suitable image found. Did find:
/var/folders/f_/ll33dc315ldc738pbth9339m0000gp/T/8eb7bd0516654c7bf3e2d99959b4166cc3c7cfc31e647d23d51a23475f407d8a/canvas.node: mach-o, but wrong architecture
/private/var/folders/f_/ll33dc315ldc738pbth9339m0000gp/T/8eb7bd0516654c7bf3e2d99959b4166cc3c7cfc31e647d23d51a23475f407d8a/canvas.node: mach-o, but wrong architecture
at tryImporting (pkg/prelude/bootstrap.js:2028:37)
at tryImporting (pkg/prelude/bootstrap.js:2080:16)
at process.dlopen (pkg/prelude/bootstrap.js:2103:7)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at Module.require (pkg/prelude/bootstrap.js:1676:31)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/snapshot/js/node_modules/canvas/lib/bindings.js:3:18)
(base) ```
Just use a linux distro if you could, save yourself from the m1 hell
@Qambar Did you figure it out, I'm having trouble getting CLI working on M1.
To make it work try using $ ts-node ~/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts
instead of metaplex
.
There is a problem on the executable built and its also happens on Ubuntu 20.04.
thats my folder where candy-machine-cli.ts is located but should change it to yours.
I'm successfully running it on M1
Just use the ts-node
command, but don't forget to do all the things necessary first => install typescript, install ts-node, yarn install & build on cli directory
+1 had the same issue with macos-x64 build
+1
had the same issue with macos-x64 build
Use ts-node as I suggested.
Hi, im having the same problem and the ts-node solution didnt work
ts-node src/candy-machine-cli.ts
Error: dlopen(/Users/pepegis/Documents/Pepe/Solana/metaplex/js/node_modules/canvas/build/Release/canvas.node, 1): no suitable image found. Did find:
/Users/pepegis/Documents/Pepe/Solana/metaplex/js/node_modules/canvas/build/Release/canvas.node: mach-o, but wrong architecture
/Users/pepegis/Documents/Pepe/Solana/metaplex/js/node_modules/canvas/build/Release/canvas.node: mach-o, but wrong architecture
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1127:18)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/pepegis/Documents/Pepe/Solana/metaplex/js/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
node -v v14.17.0
ts-node -v v10.4.0
Any suggestions ?
@felipeinfantino This is because the canvas
library only comes with binaries built for x86-64 (Intel), but none for the M1 Mac. You'll need to build the canvas
library from source:
# With yarn:
npm_config_build_from_source=true yarn add -W canvas
# With node
npm install --build-from-source canvas
@Nasafato
Followed every step, still have the same issue.
"mach-o, but wrong architecture"
canvas pngquant-bin @toruslabs/eccrypt may be have some problem
Has anyone found a fix for this yet? I'm facing this issue on my M1 Pro.
I am also facing the same issue on the m1, Have followed the suggestions in this thread
my issue is with the v2-cli
especially this command ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts --version
output:
➜ ~ ts-node metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts --version
Error: dlopen(/Users/john/metaplex-foundation/metaplex/js/node_modules/canvas/build/Release/canvas.node, 1): no suitable image found. Did find:
/Users/john/metaplex-foundation/metaplex/js/node_modules/canvas/build/Release/canvas.node: mach-o, but wrong architecture
/Users/john/metaplex-foundation/metaplex/js/node_modules/canvas/build/Release/canvas.node: mach-o, but wrong architecture
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (/Users/john/metaplex-foundation/metaplex/js/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
code: 'ERR_DLOPEN_FAILED'
}
interestingly, if I use nasafato's suggestion and build using npm install --build-from-source canvas
I get a bunch of type errors from :
➜ ~ ts-node ~/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts --version
/Users/john/.volta/tools/image/packages/ts-node/lib/node_modules/ts-node/src/index.ts:750
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:4:10 - error TS2305: Module '"commander"' has no exported member 'program'.
4 import { program } from 'commander';
~~~~~~~
metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:5:25 - error TS2307: Cannot find module '@project-serum/anchor' or its corresponding type declarations.
5 import * as anchor from '@project-serum/anchor';
~~~~~~~~~~~~~~~~~~~~~~~
metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:14:45 - error TS2307: Cannot find module '@solana/web3.js' or its corresponding type declarations.
14 import { PublicKey, LAMPORTS_PER_SOL } from '@solana/web3.js';
~~~~~~~~~~~~~~~~~
metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:40:17 - error TS2307: Cannot find module 'loglevel' or its corresponding type declarations.
40 import log from 'loglevel';
~~~~~~~~~~
metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:46:25 - error TS2307: Cannot find module 'mime' or its corresponding type declarations.
46 import { getType } from 'mime';
~~~~~~
at createTSError (/Users/john/.volta/tools/image/packages/ts-node/lib/node_modules/ts-node/src/index.ts:750:12)
at reportTSError (/Users/john/.volta/tools/image/packages/ts-node/lib/node_modules/ts-node/src/index.ts:754:19)
at getOutput (/Users/john/.volta/tools/image/packages/ts-node/lib/node_modules/ts-node/src/index.ts:941:36)
at Object.compile (/Users/john/.volta/tools/image/packages/ts-node/lib/node_modules/ts-node/src/index.ts:1243:30)
at Module.m._compile (/Users/john/.volta/tools/image/packages/ts-node/lib/node_modules/ts-node/src/index.ts:1370:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object.require.extensions.<computed> [as .ts] (/Users/john/.volta/tools/image/packages/ts-node/lib/node_modules/ts-node/src/index.ts:1374:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
diagnosticText: `\x1B[96mmetaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m4\x1B[0m:\x1B[93m10\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2305: \x1B[0mModule '"commander"' has no exported member 'program'.\n` +
'\n' +
"\x1B[7m4\x1B[0m import { program } from 'commander';\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~\x1B[0m\n' +
"\x1B[96mmetaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m5\x1B[0m:\x1B[93m25\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module '@project-serum/anchor' or its corresponding type declarations.\n" +
'\n' +
"\x1B[7m5\x1B[0m import * as anchor from '@project-serum/anchor';\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~~~~~~~~~~~~~~\x1B[0m\n' +
"\x1B[96mmetaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m14\x1B[0m:\x1B[93m45\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module '@solana/web3.js' or its corresponding type declarations.\n" +
'\n' +
"\x1B[7m14\x1B[0m import { PublicKey, LAMPORTS_PER_SOL } from '@solana/web3.js';\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~~~~~~~~\x1B[0m\n' +
"\x1B[96mmetaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m40\x1B[0m:\x1B[93m17\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module 'loglevel' or its corresponding type declarations.\n" +
'\n' +
"\x1B[7m40\x1B[0m import log from 'loglevel';\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~\x1B[0m\n' +
"\x1B[96mmetaplex-foundation/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m46\x1B[0m:\x1B[93m25\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module 'mime' or its corresponding type declarations.\n" +
'\n' +
"\x1B[7m46\x1B[0m import { getType } from 'mime';\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~\x1B[0m\n',
diagnosticCodes: [ 2305, 2307, 2307, 2307, 2307 ]
}
versions
➜ ~ node --version
v14.18.3
➜ ~ yarn --version
1.22.15
➜ ~ ts-node --version
v10.4.0
This is the only way it worked for me -> https://github.com/Automattic/node-canvas/issues/1733#issuecomment-1019991052
For M1 you need to follow this and it should work: https://docs.metaplex.com/candy-machine-v2/getting-started#apple-m1-chip
For M1 you need to follow this and it should work: https://docs.metaplex.com/candy-machine-v2/getting-started#apple-m1-chip
it works for me. thanks!
$ brew install pkg-config cairo pango libpng jpeg giflib librsvg
It seems to be creating a file canvas.node in /var/folders/f_/ll33dc315ldc738pbth9339m0000gp/T/8eb7bd0516654c7bf3e2d99959b4166cc3c7cfc31e647d23d51a23475f407d8a/canvas.node
And throwing following error on M1 Mac Apple