question

Smeech avatar image
Smeech asked

Run ask commands as npm script

This is more like a bug report since there is no issue board for ask cli :(
Since my upgrade of ask-cli from 1.6.x to 1.7.x when running npm scripts containing ask commands an error is returned:


Ask-cli version: 1.7.10

Ask version: 2.7.0

Node version: 11.6.0


Script in package.json:

```

"deploy": "ask validate -l en-US"

```


Error:

```

> my-skill@1.0.0 bla /Users/xxxxx/Projekte/alexa-skills/my-skill

> ask validate -l en-US

internal/modules/cjs/loader.js:605

throw err;

^

Error: Cannot find module '@src/utils/constants'

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)

at Function.Module._resolveFilename (/Users/xxxxx/Projekte/alexa-skills/my-skill/node_modules/module-alias/index.js:49:29)

at Function.Module._load (internal/modules/cjs/loader.js:529:25)

at Module.require (internal/modules/cjs/loader.js:657:17)

at require (internal/modules/cjs/helpers.js:22:18)

at Object.<anonymous> (/Users/xxxxx/Projekte/alexa-skills/my-skill/node_modules/ask-cli/lib/commands/init/index.js:1:81)

at Module._compile (internal/modules/cjs/loader.js:721:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)

at Module.load (internal/modules/cjs/loader.js:620:32)

at tryModuleLoad (internal/modules/cjs/loader.js:560:12)


npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! my-skill@1.0.0 bla: `ask validate -l en-US`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the my-skill@1.0.0 bla script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

npm ERR! /Users/xxxxx/.npm/_logs/2019-08-02T19_03_27_519Z-debug.log

```

ask cli
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Anand@Amazon avatar image
Anand@Amazon answered

Hi there,

Thanks for reaching out to us.

I have raised your issue with our internal team and they are looking into your issue.

I will update you once I will have information to share.

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-e07d36b7-2fb7-4161-9417-e1cdbb084d8d avatar image
newuser-e07d36b7-2fb7-4161-9417-e1cdbb084d8d answered

Hi @Smeech,
I was unable to reproduce the issue at my end.
Repro steps:
-> Installed cli version 1.7.10 (https://www.npmjs.com/package/ask-cli) -> I have an existing skill linked to my account. Ran the following command *ask validate -s <skill-id> -l en-US -p <profile>*
Could you kindly share the details (repro steps) that you followed ?

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Anand@Amazon avatar image
Anand@Amazon answered

Hello @Smeech

We are unable to repro this issue on our end.

Can you check after uninstall and re-install again?

6 comments
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello,

reinstallation didnt fix it. You can download my repository and follow these step to reproduce:


clone: https://github.com/sem4phor/alexa-boilerplate

npm run validate
This executes the command ask validate -l en-US as seen in package.json.

But it fails. Can you confirm it?

0 Likes 0 ·

Same goes for deploy command

0 Likes 0 ·

Hey @Smeech

Thanks for providing github link.

I cloned your project and after few changes I was able to deploy and successfully ran validate command without any issue.

Check here : https://github.com/cooldevil007/CLIValidate-Issues

I have also removed "pre-commits" and "pre-push" hooks because I was getting error while uploading to github but you can run "validate" commands with these hooks without any problem.

Check below link for screenshot details:

https://skill-screenshot.s3.amazonaws.com/Screen+Shot+2019-08-12+at+1.02.23+PM.png

0 Likes 0 ·

I replied in a github issue in your repo :)

0 Likes 0 ·

Hello @Smeech

Thanks for providing details.

I have reached out to our team with all these details and they are looking into this issue. I will provide details once I will get information from them.

1 Like 1 ·
Show more comments
newuser-def5fc75-e567-482b-9c97-e9622d354a29 avatar image
newuser-def5fc75-e567-482b-9c97-e9622d354a29 answered

I fixed this issue by making sure the ask-cli was installed locally in project root and not just globally as npm module.

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.