Closed shivamiitgoa closed 2 years ago
As nearcore has dependencies that doesn't support M1 chip, we can only build nearcore and sandbox (a specially configured version of nearcore) as Darwin x86-64. So we'll need to fix: always download Darwin x86-64 build of sandbox binary. And M1 users will be able to run with rosetta
Hey @ailisp
I built the nearcore from the source but still when I am trying to install near-workspaces-ava
, I am getting error.
The error is same as above
I am able to get it working using these steps:
arch -x86_64 zsh
This activates the cli in x64 modeyarn
to install dependenciesIt worked after this 🎉
I am closing this issue.
@shivamiitgoa Your workaround seems to require a "dirty state" repo, as it didn't work after freshly running npx near-workspaces-init
. A reproducible way to get it to install is:
yarn install # this will actually fail
arch -x86_64 zsh -c 'npm install'
# Now it looks like it worked, but AVA wouldn't start until I added the following
npm install ts-node
Several other versions I tried didn't work, specifically I couldn't get it to work with either yarn
or npm
alone. npm
complained about an old-format package-lock.json
(which didn't exist when invoking it), but hey, it kind of works.
Edit: I request keeping this open, as the install step works, but it won't run. I'll be presented with
Contract works
Rejected promise returned by test. Reason:
Error {
message: 'Unsupported platform: Darwin arm64',
}
› getPlatform (node_modules/near-sandbox/dist/getBinary.js:13:11)
› AWSUrl (node_modules/near-sandbox/dist/getBinary.js:16:30)
› getBinary (node_modules/near-sandbox/dist/getBinary.js:27:19)
› sandboxBinary (node_modules/near-workspaces/src/internal-utils.ts:17:75)
› ensureBinary (node_modules/near-workspaces/src/internal-utils.ts:54:37)
› Function.init (node_modules/near-workspaces/src/container/server.ts:99:38)
› SandboxRuntime.beforeRun (node_modules/near-workspaces/src/container/runtime.ts:262:39)
› SandboxRuntime.createRun (node_modules/near-workspaces/src/container/runtime.ts:111:18)
› Function.create (node_modules/near-workspaces/src/container/runtime.ts:215:21)
I tried running e.g. arch -x86_64 npm test
or with a zsh -c
squeezed in, but obviously wasn't that successful.
Edit2: A very dirty workaround is to redefine getPlatform
in node_modules/near-sandbox/dist/getBinary.js
:
function getPlatform() {
const type = os.type();
const arch = os.arch();
if ((type === "Linux" || type === "Darwin") && arch === "x64") {
return [type, "x86_64"];
}
if (type === "Darwin" && arch === "arm64") return [type, "x86_64"];
throw new Error(`Unsupported platform: ${type} ${arch}`);
}
The tests will however run.
More details about the error: