line / create-liff-app

Start developing LIFF application with a simple CLI command.
https://developers.line.biz/en/docs/liff/
Apache License 2.0
63 stars 8 forks source link

Failed create app on Nuxt.js #27

Open nojimage opened 1 year ago

nojimage commented 1 year ago

πŸ› Bug Report

I can't create an app with the Nuxt.js template using the 'create-liff-app' command.

πŸ’ Possible Solution

In Stack trace, I've got at GeneratorContext.actions (~/node_modules/create-nuxt-app/lib/saofile.js:81:22)

The code looks like this:

https://github.com/nuxt/create-nuxt-app/blob/2f58b48a9e1fb3f78c465569e8441313cfc89642/packages/create-nuxt-app/lib/saofile.js#L81

    if (this.answers.template !== 'html') {
      actions.push({
        type: 'add',
        files: '**',
        templateDir: join(frameworksDir, this.answers.template)
      })
    }

I speculate that the error is happening because there is no 'template' specification in the 'answers' option sent to 'create-nuxt-app'.

πŸ’» Code Sample

Reproduction steps οΌ† Error logs:

npx @line/create-liff-app -t nuxtjs --ts --npm liff-app
Welcome to the Create LIFF App
? Please enter your LIFF ID: 
 Don't you have LIFF ID? Check out https://developers.line.biz/ja/docs/liff/getting-started/ liffId

Generating liff app using `create-app`, this might take a while.

create-nuxt-app v5.0.0
✨  Generating Nuxt.js project in liff-app
Trace: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:399:5)
    at validateString (node:internal/validators:163:11)
    at join (node:path:1172:7)
    at GeneratorContext.actions (/root/.npm/_npx/ea7c6e7510ea3309/node_modules/create-nuxt-app/lib/saofile.js:81:22)
    at module.exports (/root/.npm/_npx/ea7c6e7510ea3309/node_modules/sao/lib/runActions.js:12:30)
    at SAO.runGenerator (/root/.npm/_npx/ea7c6e7510ea3309/node_modules/sao/lib/index.js:133:36)
    at SAO.run (/root/.npm/_npx/ea7c6e7510ea3309/node_modules/sao/lib/index.js:101:16) {
  code: 'ERR_INVALID_ARG_TYPE'
}
    at /root/.npm/_npx/ea7c6e7510ea3309/node_modules/create-nuxt-app/lib/cli.js:56:19
{
  command: 'npx create-nuxt-app liff-app --answers {"name":"liff-app","pm":"npm","language":"ts","features":["axios"],"linter":["eslint"],"ui":"none","test":"none","mode":"universal","target":"server","devTools":"none","vcs":"none"}'
}

🌍 Your Environment

nojimage commented 1 year ago

Could it be that create-liff-app doesn't yet support create-nuxt-app 5.0?

jtsaich commented 1 year ago

The problem is actually not due to having no answers, but not having template. You can see that all create-liff-app is actually doing is just generating the command line prompt npx create-nuxt-app liff-app --answers {"name":"liff-app","pm":"npm","language":"ts","features":["axios"],"linter":["eslint"],"ui":"none","test":"none","mode":"universal","target":"server","devTools":"none","vcs":"none"}.

And nuxt is expecting answers to include template, but it's not providing it. template for create-nuxt-app is either html or pug