Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI V.8 is not working under M1 #10193

Open
5 tasks done
biller-aivy opened this issue Apr 12, 2022 · 37 comments
Open
5 tasks done

CLI V.8 is not working under M1 #10193

biller-aivy opened this issue Apr 12, 2022 · 37 comments
Labels
feature-request Request a new feature installation Issues tied to installation of the CLI p2

Comments

@biller-aivy
Copy link

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

npm install -g @aws-amplify/cli

If applicable, what version of Node.js are you using?

v17.8.0

Amplify CLI Version

@newest

What operating system are you using?

macOS

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

Nope

Amplify Categories

Not applicable

Amplify Commands

Not applicable

Describe the bug

When I install the newest cli, the cli is VOID.
amplify --v is not return any text.
all other amplify commands too.

Expected behavior

.. do something.

Reproduction steps

reInstalled macOS today and installed the cli

GraphQL schema(s)

# Put schemas below this line

Log output

# Put your logs below this line


Additional information

No response

@josefaidt
Copy link
Contributor

Hey @biller-aivy 👋 thanks for raising this! Unfortunately I am not able to reproduce on my M1 mac using Node versions 14, 16, and 17. How was Node and npm installed?

@josefaidt josefaidt added installation Issues tied to installation of the CLI pending-response Issue is pending response from the issue author pending-triage Issue is pending triage labels Apr 12, 2022
@biller-aivy
Copy link
Author

@josefaidt after I pulled my amplify app, and updated it to v8 it is working.
Installed over Homebrew

@josefaidt
Copy link
Contributor

Thanks for clarifying @biller-aivy ! To clarify, is this working now? What sort of issues were you seeing prior to fixing the issue?

@josefaidt josefaidt added pending-close-response-required and removed pending-response Issue is pending response from the issue author labels Apr 12, 2022
@saif003
Copy link

saif003 commented Apr 12, 2022

@biller-aivy I'm also facing the same issue that there is no output on executing any amplify cli command, can you share how did you resolve this? Otherwise I feel like I'll have open a new issue.

@biller-aivy biller-aivy reopened this Apr 12, 2022
@biller-aivy
Copy link
Author

i installed the v7 and pulled my project, after that, I installed v8

@saif003
Copy link

saif003 commented Apr 12, 2022

i installed the v7 and pulled my project, after that, I installed v8

downgrading to 7.6.26 fixed the issue for me as well.

@josefaidt
Copy link
Contributor

Hey @saif003 and @biller-aivy would y'all mind sharing a screenshot of the install and first command execution? Unfortunately I have not been able to reproduce this issue on my end using an M1 mac

@saif003
Copy link

saif003 commented Apr 16, 2022

@josefaidt here you go,
Screenshot 2022-04-16 at 2 29 30 PM

and when I install using following command then amplify runs as expected.

npm install -g @aws-amplify/cli@7 --force

Screenshot 2022-04-16 at 2 32 50 PM

I'm using node 16.1.0, and I've installed node using asdf using following commands,

asdf plugin add nodejs
asdf install nodejs 16.1.0
asdf global nodejs 16.1.0

I've also tried with latest version of node directly without asdf but was still getting the same issue.

@josefaidt
Copy link
Contributor

Hey @saif003 thank you for those screenshots, and while I initially tested on Node 16.14.1/2 I downgraded to 16.1.0 to no avail
image

Can you post a snippet from your logs at ~/.amplify/logs at the time this occurs?

@josefaidt
Copy link
Contributor

Hey @biller-aivy 👋 just wanted to follow-up on my previous message and see if you are able to capture logs at the time this occurs?

@bc4253
Copy link

bc4253 commented May 3, 2022

Starting with Amplify v8 on OSX (M1), using the amplify upgrade command seems to be the culprit. After the upgrade, any amplify command, even "amplify -v" produces no output. I have to completely remove the package "npm remove .." and then "npm install ..." to restore normal operations.

@josefaidt
Copy link
Contributor

Hey @bc4253 did you install the CLI initially using sudo by chance? After executing amplify upgrade the first command does take an excessive amount of time to respond but it should print something

@josefaidt
Copy link
Contributor

Hey @biller-aivy and @bc4253 just wanted to follow-up here and see if you are still experiencing this issue?

@crzyjcky
Copy link

crzyjcky commented May 19, 2022

Chip: Apple M1 Pro

% node -v
v18.2.0

% npm -v
8.9.0

% curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL
...
bash: line 111: /Users/<home folder>/.amplify/bin/amplify: Bad CPU type in executable

% npm i -g @aws-amplify/cli
added 26 packages, and audited 27 packages in 36s

% amplify # return nothing
% which amplify
/Users/<home folder>/.amplify/bin/amplify

 % /Users/<home folder>/.amplify/bin/amplify
zsh: bad CPU type in executable: /Users/<home folder>/.amplify/bin/amplify

v7 seems like working

% npm install -g @aws-amplify/cli@7 --force
% amplify -v
7.6.26

@josefaidt
Copy link
Contributor

Hey @crzyjcky can you paste the output of running arch and try installing Rosetta with softwareupdate --install-rosetta to see if this mitigates the issue?

@crzyjcky
Copy link

hi @josefaidt, after installing softwareupdate --install-rosetta, amplify-cli v8 works. Thanks.

% arch
arm64

% amplify -version
8.2.0

@josefaidt
Copy link
Contributor

Hey @crzyjcky I'm glad to hear that worked well! I'll mark this as a documentation issue to add this callout to our installation docs!

@josefaidt josefaidt added documentation Add or update documentation p2 and removed pending-close-response-required pending-triage Issue is pending triage labels May 23, 2022
@metsaiga09
Copy link

I am also on OSX M1 and just ran into the no output on cli v8 issue while setting up a new machine. Downgrading to v7 worked well. It feels like requiring a rosetta install to work with a newer version of cli is a step backwards. Hoping whatever dependency in v8 that seems to require rosetta can be eliminated or updated to support m1 natively.

@bc4253
Copy link

bc4253 commented May 24, 2022

I am still having issues. I originally installed some v8 version a few weeks back and all was fine until there was an upgrade. After running amplify upgrade, then amplify always return no cli output of any kind. However if I run "sudo amplify --version" or any other amplify command, it works fine. I just ran the upgrade to v8.3.0 and still have the same issue. I have not recently tried to uninstall and reinstall. last time I tried the uninstall/reinstall that did not fix my problem. I had just finished following the procedure to add a .npm-global directory, maybe that is the cause of why a fresh install doesnt work either?

@InnovateWithEric
Copy link

@bc4253 - did you try the step in this message above: #10193 (comment) ? Does that fix for you?

@bc4253
Copy link

bc4253 commented Jun 14, 2022

@bc4253 - did you try the step in this message above: #10193 (comment) ? Does that fix for you?

It does not, I already have rosetta installed. the arch command returns arm64

@Tchekda
Copy link

Tchekda commented Jul 12, 2022

Same problem found on NixOS 22.05, had to downgrade to make it work !

@dlamon1
Copy link

dlamon1 commented Jul 14, 2022

I'm on M1, installing Rosetta worked for me. Thank you @josefaidt

@wderezin
Copy link

The M1, arm64, is not supported.

After several different installs attempts, the amplify binary every time it generates x86.

# file  ~/.amplify/bin/amplify
~/.amplify/bin/amplify: Mach-O 64-bit executable x86_64

If you look at at the supported platform in the binary.ts you can see the Mac arm64 package is pointed to the x64 version.

  {
    TYPE: 'Darwin',
    ARCHITECTURE: 'arm64',
    COMPRESSED_BINARY_PATH: 'amplify-pkg-macos-x64.tgz',
  },

@wderezin
Copy link

Here is the workaround I used to get cli v9 working on Mac arm64 with Rosetta. Build from source. The Max node supported version is v16.

git clone https://github.com/aws-amplify/amplify-cli.git
cd amplify-cli
nvm use 16
yarn install
yarn run build

You get a working amplify.

# ./node_modules/.bin/amplify --version
9.1.0

@mkirby42
Copy link

Hey @bc4253 did you install the CLI initially using sudo by chance? After executing amplify upgrade the first command does take an excessive amount of time to respond but it should print something

Amplify CLI 10.0.0, Node 16.14.0, M1 Mac
I ran sudo amplify upgrade
If I run sudo before status, --help, --version, etc. it works. Id' like for this not to be the case, should I open a new issue?

@VedanthB
Copy link

hi @josefaidt, after installing softwareupdate --install-rosetta, amplify-cli v8 works. Thanks.

% arch
arm64

% amplify -version
8.2.0

This worked for me as well on M2 chip

@omidmogasemi
Copy link

hi @josefaidt, after installing softwareupdate --install-rosetta, amplify-cli v8 works. Thanks.

% arch
arm64

% amplify -version
8.2.0

This does not work for me on an M1 MacBook Air. The only solution is to download v7, however then my configure command hangs. I have seen a few past issue reports of this, but they were all on Windows.

% amplify -v
7.6.26

% amplify configure
? Select the backend providers. (Press <space> to select, <a> to toggle all, <i> to invert selection)

No other output or backend providers shown.

@josefaidt josefaidt added feature-request Request a new feature and removed documentation Add or update documentation labels Oct 3, 2022
@bc4253
Copy link

bc4253 commented Oct 11, 2022 via email

@kzetxa
Copy link

kzetxa commented Oct 26, 2022

I was able to get it working by downloading amplify-pkg-macos.tgz file from releases.

I deleted the binary at /usr/local/bin/amplify, renamed the binary inside the package that I downloaded, and moved it to the location where the old deleted binary was. I noticed that I also needed to do sudo chown -R $(whoami) ~/.amplify. It seems after running amplify, I have another binary in my ~/.amplify directory.

Not sure why installing it via NPM was not working. I had no errors, just a dead binary with no output.

I am running on a 2021 Macbook Pro 16" M1 Max, with Node 16.12.0, Amplify 10.3.1, and macOS Monterey 12.6.

@ansatz-leander
Copy link

ansatz-leander commented Nov 12, 2022

I was able to get it working by downloading amplify-pkg-macos.tgz file from releases.

I deleted the binary at /usr/local/bin/amplify, renamed the binary inside the package that I downloaded, and moved it to the location where the old deleted binary was. I noticed that I also needed to do sudo chown -R $(whoami) ~/.amplify. It seems after running amplify, I have another binary in my ~/.amplify directory.

Not sure why installing it via NPM was not working. I had no errors, just a dead binary with no output.

I am running on a 2021 Macbook Pro 16" M1 Max, with Node 16.12.0, Amplify 10.3.1, and macOS Monterey 12.6.

This worked for me, thanks!
I am running on 2021 Macbook Pro 14" M1 Ultra, with Node 16.18.1, Amplify 10.4.1, and macOS Monterey 12.5.

@danrivett
Copy link

danrivett commented Nov 16, 2022

I was able to get it working by downloading amplify-pkg-macos.tgz file from releases.
...

@kzetxa's suggestion didn't work for me, since it still downloads an x86 build, it fails with Bad CPU type in executable.

Here is the workaround I used to get cli v9 working on Mac arm64 with Rosetta. Build from source. The Max node supported version is v16.

git clone https://github.com/aws-amplify/amplify-cli.git
cd amplify-cli
nvm use 16
yarn install
yarn run build

...

@wderezin's suggestion did work for me (many thanks!) with a couple of minor additions to allow the amplify command to work from anywhere. Here's what worked for me:

$ git clone https://github.com/aws-amplify/amplify-cli.git
$ cd amplify-cli
$ git checkout v10.4.1 # Avoids building the dev branch but builds a release tag; update as necessary
$ yarn && yarn build # I'm using node 16 globally
$ rm ~/.amplify/bin/amplify
$ ln -s $(pwd)/packages/amplify-cli/bin/amplify ~/.amplify/bin/amplify

Now you can run amplify status from an amplify project and it should work.

It's pretty frustrating that this is still required. I guess AWS expects us to brute-force the issue via Rosetta, but I haven't needed Rosetta up until now so I'd rather avoid it.

@thtliife
Copy link

thtliife commented Mar 27, 2023

Thanks @wderezin and @danrivett
Building from source on my m1 machine without Rosetta installed sorted this out for me.
I am trying to keep my macbook running m1 native apps only, as i believe emulating apps to be a bit of a step backwards.
The information you guys provided was very valuable in keeping my system running native binaries only :)

@martip
Copy link

martip commented Jun 8, 2023

Thanks @danrivett and everyone!

Following your suggestions I managed to build the project from source without Rosetta.

I agree with @thtliife: using Rosetta doesn't seem the right way to go.

I had to fix one thing, though, because I got some errors when invoking yarn.

I am using Node.js v19.2.0.

After checking out the desired version (git checkout v12.0.3 in my case), I had to add the following to the resolutions section of package.json:

"resolutions": {
  "nan": "2.17.0",
  ...

to force the usage of the version of the nan package (https://github.com/nodejs/nan/) in which the maintainers just fixed a bug.

The nan package is not directly required in the root package.json, but it's required throughout the setup process.

After applying this modification, the installation and building of the project went smoothly for me.

If you link the command (ln -s...) as @danrivett suggests, you may need to add ~/.amplify/bin to your PATH:

export PATH="/Users/$USER/.amplify/bin:$PATH"

To make the addition permanent, add the command to your shell profile file (ie .zshrc or .bash_profileetc.).

Hope this helps!

@rolme
Copy link

rolme commented Nov 8, 2023

Still unable to find a better fix then above. That said, was able to build latest version of aws-amplify/cli using Node v21.1.0 without modifying package.json.

@wish-me-luck
Copy link

I started my project on an AMD chip and Just migrated to M1 chip new laptop.

my current M1 laptop
node -v
v21.2.0
npm -v
10.2.3

npm install -g @aws-amplify/cli

amplify cli wasn't working at all
amplify -v no output
amplify --console no output.

Tried to downgrade to amplify7
npm install -g @aws-amplify/cli@7 --force

amplify --version
(node:18338) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Invalid feature flag configuration

These feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:

  • graphqltransformer.usesubusernamefordefaultidentityclaim
  • graphqltransformer.usefieldnameforprimarykeyconnectionfield
  • graphqltransformer.enableautoindexquerynames
  • graphqltransformer.respectprimarykeyattributesonconnectionfield
  • graphqltransformer.shoulddeepmergedirectiveconfigdefaults
  • graphqltransformer.populateownerfieldforstaticgroupauth
  • codegen.generatemodelsforlazyloadandcustomselectionset

This issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version.

Learn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags

amplify init
(node:18341) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Invalid feature flag configuration

These feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:

  • graphqltransformer.usesubusernamefordefaultidentityclaim
  • graphqltransformer.usefieldnameforprimarykeyconnectionfield
  • graphqltransformer.enableautoindexquerynames
  • graphqltransformer.respectprimarykeyattributesonconnectionfield
  • graphqltransformer.shoulddeepmergedirectiveconfigdefaults
  • graphqltransformer.populateownerfieldforstaticgroupauth
  • codegen.generatemodelsforlazyloadandcustomselectionset

This issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version.

Learn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags

@wish-me-luck
Copy link

I followed @martip suggestd, still got the build error.
/amplify-cli/node_modules/node-pty: Command failed.
../../nan/nan.h:686:39: warning: 'IdleNotificationDeadline' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature installation Issues tied to installation of the CLI p2
Projects
None yet
Development

No branches or pull requests