ThomasVuillaume / alexa-skill-typescript-boilerplate-ask-v2

A complete i18nized Alexa Skill boilerplate to start developing and deploying a TypeScript skill in no time, based on the official ask-cli v2 Hello World example.
MIT License
6 stars 0 forks source link

Can't build & deploy // Can you pls give instructions? #3

Open gotwig opened 3 years ago

gotwig commented 3 years ago
PS C:\Users\gotwi\alexa-test\Eddy-Alexa-Test> ask deploy
Deploy configuration loaded from ask-resources.json
Deploy project for profile [default]

==================== Deploy Skill Metadata ====================
[Warn]: The hash of current skill package folder does not change compared to the last deploy hash result, CLI will skip the deploy of skill package.
Skill ID: amzn1.ask.skill.5c082b5d-283e-47e5-a0c6-30010c893abc

==================== Build Skill Code ====================
Running task : compile
[00:49:44] 'compile' errored after 2 s
[00:49:44] Error: TypeScript: Compilation failed
    at Output.mightFinish (C:\Users\gotwi\alexa-test\Eddy-Alexa-Test\node_modules\gulp-typescript\release\output.js:131:43)
    at C:\Users\gotwi\alexa-test\Eddy-Alexa-Test\node_modules\gulp-typescript\release\output.js:44:22
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
[00:49:44] 'post-install-hook' errored after 2.01 s
npm ERR! code 1
npm ERR! path C:\Users\gotwi\alexa-test\Eddy-Alexa-Test\.ask\lambda
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c gulp post-install-hook

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\gotwi\AppData\Local\npm-cache\_logs\2021-03-23T23_49_44_469Z-debug.log
Show-Log : post-install-hook exited with an error.
In C:\Users\gotwi\alexa-test\Eddy-Alexa-Test\hooks\build.ps1:115 Zeichen:13
+             Show-Log "post-install-hook exited with an error." "Error ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Show-Log

[Error]: Command failed: PowerShell.exe -Command "& {& 'C:\Users\gotwi\alexa-test\Eddy-Alexa-Test\hooks\build.ps1' 'C:\Users\gotwi\alexa-test\Eddy-Alexa-Test\.ask\lambda\build.zip' $False }"
PS C:\Users\gotwi\alexa-test\Eddy-Alexa-Test> 
ThomasVuillaume commented 3 years ago

Thank you for opening that issue. I'm taking a look into it, and will git back to you as soon as possible.

Btw, this is not related yet but : Did you noticed the mention to that page here and did you installed the PS module ?

Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force

ThomasVuillaume commented 3 years ago

I just tested out from an newly cloned repository, and I have no issue :

Windows PowerShell
Copyright (C) Microsoft Corporation. Tous droits réservés.
                                                                                                                                                                                                                 Testez le nouveau système multiplateforme PowerShell https://aka.ms/pscore6                                                                                                                                                                                                                                                                                                                                                       PS C:\Users\tvuillaume> cd .\persProject\alexa-skill-typescript-boilerplate-ask-v2\                                                                                                                              PS C:\Users\tvuillaume\persProject\alexa-skill-typescript-boilerplate-ask-v2> ask deploy                                                                                                                         Deploy configuration loaded from ask-resources.json
Deploy project for profile [default]

==================== Deploy Skill Metadata ====================
Skill package deployed successfully.
Skill ID: amzn1.ask.skill.25af943e-d747-48b9-9783-59c849a5e14c

==================== Build Skill Code ====================
npm WARN @typescript-eslint/eslint-plugin@2.34.0 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@2.34.0 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.

Running task : compile
Running task : clean-ts
Skill code built successfully.
Code for region default built to C:\Users\tvuillaume\persProject\alexa-skill-typescript-boilerplate-ask-v2\.ask\lambda\build.zip successfully with build flow CustomBuildFlow.

==================== Deploy Skill Infrastructure ====================
  √ Deploy Alexa skill infrastructure for region "default"
  The api endpoints of skill.json have been updated from the skill infrastructure deploy results.
Skill infrastructures deployed successfully through @ask-cli/lambda-deployer.

==================== Enable Skill ====================
Skill is enabled successfully.
PS C:\Users\tvuillaume\persProject\alexa-skill-typescript-boilerplate-ask-v2> node -v
v12.14.1
PS C:\Users\tvuillaume\persProject\alexa-skill-typescript-boilerplate-ask-v2>
PS C:\Users\tvuillaume\persProject\alexa-skill-typescript-boilerplate-ask-v2\lambda> tsc -v
Version 3.7.5

Could you run a tsc -v and a node -v command in you powershell prompt and give me the output ?

gotwig commented 3 years ago

PS C:\Users\gotwi> tsc -v Version 4.2.3 PS C:\Users\gotwi> node -v v15.12.0 PS C:\Users\gotwi>

I ran the command already: Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force

Can you please give instructions after cloning what to do? I also wanted to run this as an alexa hosted skill is this supported?

I tried to ask init , or go into lambda, build, go into main and ask deploy, nothing seemed to work. in lambda dir I had no issues about building but then doing ask deploy from main dir didnt work. Why is package.json in lambda dir but not in main dir?

gotwig commented 3 years ago

Looking at this page its saying Alexa Hosted Skills dont use the ask deploy command anymore, but just git push. Any idea? https://developer.amazon.com/de-DE/docs/alexa/hosted-skills/alexa-hosted-skills-ask-cli.html

ThomasVuillaume commented 3 years ago

Regarding Alexa Hosted Skills, I did'nt test yet. I'll try asap and get back to you.

What I do basically is :

Before all that be sure to have run the ask configure once.

ThomasVuillaume commented 3 years ago

PS C:\Users\gotwi> tsc -v Version 4.2.3 PS C:\Users\gotwi> node -v v15.12.0 PS C:\Users\gotwi>

Could you try to use a 3.x TypeScript version ? Like a 3.9.7 ?

gotwig commented 3 years ago

Installed typescript 3.9.7 globaly. doing exactly what you said I get dependency errors about not installed packages when doing ask deploy from root dir:

error
ThomasVuillaume commented 3 years ago

Did you installed those packages as mentionned in the readme ?

A global installation is required for the following packages: gulp-cli [2.3.0] ask-cli [2.22.0] bespoken-tools [2.4.88]

You need to install them globally like npm install -g gulp-cli@2.3.0

gotwig commented 3 years ago

btw in package.json in lambda is this listed: "typescript": "^4.1.3"

I tried what you recommended but the error is still there. I try to reclone and do everything again.

` ==================== Build Skill Code ==================== [11:59:19] Local gulp not found in ~\alexa-test\alexa-skill-typescript-boilerplate-ask-v2.ask\lambda [11:59:19] Try running: npm install gulp npm ERR! code 1 npm ERR! path C:\Users\gotwi\alexa-test\alexa-skill-typescript-boilerplate-ask-v2.ask\lambda npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c gulp post-install-hook

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\gotwi\AppData\Local\npm-cache_logs\2021-03-24T10_59_19_363Z-debug.log Show-Log : post-install-hook exited with an error. In C:\Users\gotwi\alexa-test\alexa-skill-typescript-boilerplate-ask-v2\hooks\build.ps1:115 Zeichen:13

[Error]: Command failed: PowerShell.exe -Command "& {& 'C:\Users\gotwi\alexa-test\alexa-skill-typescript-boilerplate-ask-v2\hooks\build.ps1' 'C:\Users\gotwi\alexa-test\alexa-skill-typescript-boilerplate-ask-v2.ask\lambda\build.zip' $False }"`

gotwig commented 3 years ago

After cleaning everything and doing the steps again, I get the same errors like with the image. No localy gulp, etc. -

What is actualy true I installed it globally like you said not locally

ThomasVuillaume commented 3 years ago

Could you try to run the npm link gulp command in the lambda folder and try again ?

gotwig commented 3 years ago

next error that comes up is "cannot find module del" -

Eventually I figured out how to get typescript running! I followed this post https://forums.developer.amazon.com/questions/224104/create-an-alexa-hosted-skill-nodejs-with-typescrip.html

I will very likely create a github repo with the steps involved, for those curios to run typescript code. I also try to integrate your typescript code. I mean basicly its just compiling everything and moving it into dist folder.

ThomasVuillaume commented 3 years ago

next error that comes up is "cannot find module del" -

Wow... You sure you ran npm install in the lambda folder ? Or try npm ci to get rid of the node_modules folder because this is really strange. The goal of this project is to be able to work out of the box : been using it for a while on differents machines and never had those errors 😨

Eventually I figured out how to get typescript running! I followed this post https://forums.developer.amazon.com/questions/224104/create-an-alexa-hosted-skill-nodejs-with-typescrip.html

I will very likely create a github repo with the steps involved, for those curios to run typescript code. I also try to integrate your typescript code. I mean basicly its just compiling everything and moving it into dist folder.

Feel free man.

gotwig commented 3 years ago

hm I still cant get it running im not sure what we can do here :D The thing is everything seems to work fine when I use npm inside the lambda folder, however from there I cant deploy with ASK. When I then try to use NPM inside the root folder those scripts of course dont work

ThomasVuillaume commented 3 years ago

Regarding Alexa Hosted Skills, I did'nt test yet. I'll try asap and get back to you.

What I do basically is :

* clone

* got to lambda folder and run `npm install`

* go back to root folder `cd ..`

* run `ask deploy`

* all fine

Before all that be sure to have run the ask configure once.

You have to run 'ask deploy' from the root folder, not the lambda folder. Look at the sequence I mentionned : npm install in the lambda folder, then go back to the root folder, finally run ask deploy.