No backend providers when installing via sudo yarn global add
Describe the bug
When installed with yarn via sudo yarn global add @aws-amplify/cli, the amplify configure command gets stuck, prompting Select the backend providers. (Press <space> to select, <a> to toggle all, <i> to invert selection) but not actually listing any options. No input did anything except exit the application.
To Reproduce
Install the amplify cli with sudo yarn global add @aws-amplify/cli and make sure that the one in your path (check with readlink -f $(which amplify)) is the one at /usr/local/share/.config/yarn/global/node_modules/.bin/amplify
Expected behavior
The amplify configure command should begin the configuration process and open the browser to log in with AWS.
Additional context The problem seems to be that it's not correctly locating the other node modules.
I think the problem may be related to the fact that I installed via sudo, and the system-level yarn packages are not discovered correctly.
When I originally tried yarn global add @aws-amplify/cli without sudo, I got errors preventing installation. It tries to install fsevents, which has event-stream "~3.3.0" as a dependency. That resolves to event-stream-3.3.6, which is listed as a version in the yarn registry, but for some reason is not actually available. The latest ~3.3.0 version actually available for download is 3.3.5. It fails to retrieve 3.3.6 with a 404 error, and gives up on installing in the $HOME/.config/yarn/global directory.
I installed with sudo, and instead of silently installing fsevents and failing on event-stream, it said linux was not compatible with fsevents and decided not to install it as an optional dependency. I don't know why it behaved differently, but the result is that it did not try to install event-stream and succeeded.
The empty providers problem is caused by the different install location. The yarn prefix code detection code fails, because it's not running from $HOME/.config/yarn/global, but in /usr/local/share/.config/yarn/global. Yarn doesn't install recursive node_modules in the @aws-amplify/cli directory, so the local node_modules detection returns nothing. Meanwhile, even though I have had it installed with sudo npm install -g at the same time, npm only installs the top package in the global /usr/lib/node_modules directory; all of the other dependencies get installed in a local recursive node_modules location, so those can't be found that way either. Consequently, no plugins are found when installed via sudo yarn global add.
This issue has already been resolved by this PR, it's merged and pending release https://github.com/aws-amplify/amplify-cli/pull/1004
The fix has been merged and released in v 1.1.8 of the CLI. Please feel free to re-open if you're still seeing this problem.
I still have this problem. amplify configure shows:
$ amplify configure
? Select the backend providers. (Press
I have this problem too for 4.28.0.
> amplify configure
? Select the backend providers. (Press <space> to select, <a> to toggle all, <i> to invert selection)
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.