Reputation: 1014
I'm running mocha tests and I recently upgraded to the newest version of the ask-cli. I ran the tests again and I'm now receiving this module error. I've npm installed src and utils to no avail. From what I've read it's possible module-alias does not support @src paths.
I'm calling this command:
$ ask api simulate-skill -l en-US -t "start my day" -s amzn1.ask.skill.XXXXXXXX-4156-4ca0-b14e-XXXXXXXXXXXX
Update: this seems to be an issue with the ask-cli which uses
const CONSTANTS = require('@src/utils/constants');
The @src should find the source of the node package but this @src is not used in any other packages I could find. All other packages seem to use ../../ so that's likely while module-alias does not find anything bc it doesn't know how to route this new syntax
Does anyone know of this new @src syntax and if there is a npm module for helping route it?
Which worked for ask-cli 1.1.6 but I upgraded to 1.7.2 for new functionality.
Error: Cannot find module '@src/utils/constants'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._resolveFilename (/Users/calebgates/WebstormProjects/AutomatedUtteranceTesting/node_modules/module-alias/index.js:49:29)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/calebgates/WebstormProjects/AutomatedUtteranceTesting/node_modules/ask-cli/lib/commands/init/index.js:1:81)
at Module._compile (module.js:652:30)
at Module.replacementCompile (/Users/calebgates/WebstormProjects/AutomatedUtteranceTesting/node_modules/nyc/node_modules/append-transform/index.js:58:13)
at module.exports (/Users/calebgates/WebstormProjects/AutomatedUtteranceTesting/node_modules/nyc/node_modules/default-require-extensions/js.js:8:9)
at Object.<anonymous> (/Users/calebgates/WebstormProjects/AutomatedUtteranceTesting/node_modules/nyc/node_modules/append-transform/index.js:62:4)
module.js:549
Upvotes: 6
Views: 2764
Reputation: 567
This is acknowledged bug when ask-cli
is installed locally. There are two work-arounds pointed out in the bug report.
Either install ask-cli
globally:
$ npm install -g ask-cli
Or install the module-alias
package:
$ npm install module-alias
and configure it to look for @src
in the ask-cli/lib
folder by adding the following to your package.json file:
"_moduleAliases": {
"@src": "./node_modules/ask-cli/lib",
"@root": "./node_modules/ask-cli",
"@test": "./node_modules/ask-cli/test"
}
Upvotes: 0
Reputation: 4095
I solved this by including the ask-sdk
in my local project's dependencies.
Upvotes: 1