amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

No backend providers when installing via sudo yarn global add

Open shader opened this issue 7 years ago • 5 comments

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.

shader avatar Mar 20 '19 10:03 shader

This issue has already been resolved by this PR, it's merged and pending release https://github.com/aws-amplify/amplify-cli/pull/1004

UnleashedMind avatar Mar 20 '19 21:03 UnleashedMind

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.

kaustavghosh06 avatar Mar 22 '19 20:03 kaustavghosh06

I still have this problem. amplify configure shows: $ amplify configure ? Select the backend providers. (Press to select, to toggle all,

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)

pickfire avatar Sep 01 '20 17:09 pickfire

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.

github-actions[bot] avatar May 25 '21 22:05 github-actions[bot]