Yoctol / bottender

⚡️ A framework for building conversational user interfaces.
https://bottender.js.org
MIT License
4.22k stars 335 forks source link

create-bottender-app failed with --typescript option #887

Closed takuan-osho closed 3 years ago

takuan-osho commented 3 years ago

Describe the bug I read this blog article of bottender and tried to start the section of Getting Started with --typescript option.

However, npx create-bottender-app my-app --typescript failed and I could not start it.

Here are the full logs when npx create-bottender-app my-app --typescript fails.

$ pwd
/Users/taku/dev/src/github.com/takuan-osho-sandbox
$ npx create-bottender-app my-app --typescript
npx: 62個のパッケージを5.217秒でインストールしました。
? What platform of bot do you want to create?
? Where do you want to store session? memory
❯
❯ Creating a new Bottender bot at /Users/taku/dev/src/github.com/takuan-osho-sandbox/my-app.
❯
❯ Installing packages... This might take a couple of minutes.
❯
warning bottender > @hapi/joi@15.1.1: Switch to 'npm install joi'
warning bottender > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > messaging-api-common > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > messaging-api-line > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > messaging-api-messenger > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > @hapi/joi > @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
warning bottender > @hapi/joi > @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
warning bottender > @hapi/joi > @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
warning bottender > messaging-api-telegram > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > messaging-api-slack > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > @hapi/joi > @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
warning bottender > @hapi/joi > @hapi/topo > @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
warning bottender > messaging-api-viber > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > ngrok > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning bottender > ngrok > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning jest > @jest/core > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[###############################################################################################################################################################################################] 1934/1934
❯
❯ Aborting installation.
✖ Unexpected error. Please report it as a bug:
❯ SyntaxError: Type expected. (4:44)
  2 | import { Action,  } from 'bottender';
  3 |
> 4 | export default async function App(context: ): Promise<Action<> | void> {
    |                                            ^
  5 |   await context.sendText('Welcome to Bottender');
  6 | };
  7 |
❯
❯ Deleting generated file... bottender.config.js
❯ Deleting generated file... node_modules
❯ Deleting generated file... package.json
❯ Deleting generated file... yarn.lock
❯ Done.

To Reproduce Steps to reproduce the behavior:

  1. Try to execute npx create-bottender-app my-app --tyescript

Then you would see the error logs like the logs I wrote in Describe the bug section.

FYI: Here is my software versions I used

$ node --version
v14.16.0
$ npm --version
6.14.11
$ npx --version
6.14.11

Expected behavior

We can do npx create-bottender-app my-app --typescript with no errors.

Screenshots

There is no screenshot.

Additional context

I think below is the part of the cause of this issue though I'm not familiar with JavaScript/TypeScript and their ecosystems. https://github.com/Yoctol/bottender/blob/v1.5.1-alpha.8/packages/create-bottender-app/src/utils/generateAppEntry.ts#L33-L45

wtflink commented 3 years ago

Thanks for the report, @takuan-osho.

I believe there is a bug within the create-bottender-app flow, you should at least select one of the platform for generating the initial code for you.

螢幕快照 2021-03-08 上午9 47 56

If you select none and click enter, the flow still carry on, and cause the error. The state like this cause the error:

螢幕快照 2021-03-08 上午9 52 38

This is the okay flow:

螢幕快照 2021-03-08 上午9 53 02

We will try to fix this issue, and maybe you can keep trying what you were trying with at least one platform selected?

Or if you have any further feedback or suggestions, please let us know!

takuan-osho commented 3 years ago

@wtflink Thank you for your quick reply!

maybe you can keep trying what you were trying with at least one platform selected?

I followed your advice and confirmed that no errors occurred when I selected one of the platforms like this. Thanks!

$ npx create-bottender-app my-app --typescript
npx: 62個のパッケージを4.611秒でインストールしました。
? What platform of bot do you want to create? line
? Where do you want to store session? memory
❯
❯ Creating a new Bottender bot at /Users/taku/dev/src/github.com/takuan-osho-sandbox/my-app.
❯
❯ Installing packages... This might take a couple of minutes.
❯
warning bottender > @hapi/joi@15.1.1: Switch to 'npm install joi'
warning bottender > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > messaging-api-common > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > messaging-api-line > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > messaging-api-telegram > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > @hapi/joi > @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
warning bottender > @hapi/joi > @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
warning bottender > @hapi/joi > @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
warning bottender > @hapi/joi > @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
warning bottender > @hapi/joi > @hapi/topo > @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
warning bottender > messaging-api-slack > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > messaging-api-messenger > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > messaging-api-viber > axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning bottender > ngrok > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning bottender > ngrok > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning jest > @jest/core > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[###############################################################################################################################################################################################] 1934/1934
❯ Success!
❯ Created my-app at /Users/taku/dev/src/github.com/takuan-osho-sandbox/my-app
❯ Please make sure you have edited .env or bottender.config.js before running the bot.
❯
❯ Inside that directory, you can run several commands:
❯
❯   yarn start
❯     Starts the production server.
❯
❯   yarn dev
❯     Starts the development server.
❯
❯   yarn lint
❯     Checks the code with the linter.
❯
❯ We suggest that you begin by typing:
❯
❯   cd my-app
❯   yarn dev
❯
❯ Happy hacking!

FYI: when I created this issue, I missed the below sentence generated by create-bottender-app command.

? What platform of bot do you want to create? (Press <space> to select, <a> to toggle all, <i> to invert selection)

I forgot to press space to select. I pressed return button.