aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 819 forks source link

Regression on #250 ? #2888

Closed udf2457 closed 4 years ago

udf2457 commented 4 years ago

Hi,

npm 6.13.1 Debian GNU/Linux 10 (buster) amplify 4.2.0

We seem to have a bit of a regression on #250 ?

I'm experiencing pretty much exactly the same symptoms as described. Nothing shown on the list and massive hissy-fit if you just press enter.

? Choose the type of app that you're building 
(node:14955) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'value' of undefined
    at ListPrompt.getCurrentValue (/home/foo/foobar/bar/node_modules/@aws-amplify/cli/node_modules/inquirer/lib/prompts/list.js:121:53)
    at MapSubscriber._next (/home/foo/foobar/bar/node_modules/rxjs/internal/operators/map.js:49:35)
    at MapSubscriber.Subscriber.next (/home/foo/foobar/bar/node_modules/rxjs/internal/Subscriber.js:66:18)
    at TakeSubscriber._next (/home/foo/foobar/bar/node_modules/rxjs/internal/operators/take.js:54:30)
    at TakeSubscriber.Subscriber.next (/home/foo/foobar/bar/node_modules/rxjs/internal/Subscriber.js:66:18)
    at Interface.handler (/home/foo/foobar/bar/node_modules/rxjs/internal/observable/fromEvent.js:22:28)
    at Interface.emit (events.js:215:7)
    at Interface.EventEmitter.emit (domain.js:478:20)
    at Interface._onLine (readline.js:315:10)
    at Interface._line (readline.js:692:8)
(node:14955) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14955) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
UnleashedMind commented 4 years ago

@udf2457 I can not reproduce, it might be due to a corrupt installation. Could you install the latest version, run amplify plugin scan and then try again?

twingo-b commented 4 years ago

I have a similar situation. The default [plugin-prefixes] is amplify- and [plugin-directories] is as follows:

$ npm install --save-dev '@aws-amplify/cli@4.5.0'
$ npx amplify plugin configure
? Select the following options to configure scannable plugin directories

Directories where the CLI scans for plugins::
  cli-local-node-modules
  cli-parent-directory
  global-node-modules

? Select the action on the directory list Learn more

The directories contained this list are searched for plugins in a plugin scan.
You can add or remove from this list to change the scan behavior, and consequently its outcome.
There are three well-known directories that the CLI usually scans for plugins.
cli-parent-directory
cli-parent-directory is the directory that contains the Amplify CLI Core package.
/path/to/project/node_modules/@aws-amplify/
cli-local-node-modules
cli-local-node-modules is the Amplify CLI Core package's local node_modules directory.
/path/to/project/node_modules/@aws-amplify/cli/node_modules
global-node-modules
global-node-modules is the global node_modules directory.
/path/to/global/versions/v10.16.3/lib/node_modules

However, plugin modules are installed /path/to/project/node_modules/.

$ ls node_modules/ | grep '^amplify\-'
amplify-appsync-simulator
amplify-category-analytics
amplify-category-api
amplify-category-auth
amplify-category-function
amplify-category-hosting
amplify-category-interactions
amplify-category-notifications
amplify-category-predictions
amplify-category-storage
amplify-category-xr
amplify-codegen
amplify-codegen-appsync-model-plugin
amplify-dynamodb-simulator
amplify-frontend-android
amplify-frontend-ios
amplify-frontend-javascript
amplify-graphql-docs-generator
amplify-graphql-types-generator
amplify-provider-awscloudformation
amplify-storage-simulator
amplify-util-mock
amplify-velocity-template

Therefore, it works by adding /path/to/project/node_modules/ to [plugin-directories].

ADD: Unfortunately, [plugins] settings are currently stored in $HOME/.amplify/plugins.json. So, it seems difficult to have multiple local environments.

udf2457 commented 4 years ago

@UnleashedMind My original post was written after a completely fresh install on a Debian instance that had never had amplify installed before.

kaustavghosh06 commented 4 years ago

@udf2457 Did you install the CLI globally using npm?

UnleashedMind commented 4 years ago

@udf2457 If you did not install the the CLI globally (npm install without the -g or yarn without global), you need to add the scan directory like @twingo-b pointed out.

kaustavghosh06 commented 4 years ago

@twingo-b I've seen this issue when installing the CLI with yarn. If you use npm, the directory location should be consistent and accurate. Please comment on this issue, if anyone is still seeing this issue and we'll re-open this.

tuukkamustonen commented 4 years ago

@UnleashedMind Imo, this is a rather big usability issue. Is there technical reason why local install cannot automatically discover the plugins under local node_modules?

It's kinda frustrating hitting into a problem right at the start of Getting Started.

github-actions[bot] commented 3 years ago

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.