akshayKhot akshayKhot - 1 year ago 199
TypeScript Question

Aurelia CLI + Typescript: Cannot find module errors

I am trying to set up a basic Aurelia project following the video tutorial on Aurelia Homepage here. I think I have followed the exact steps given in the video (just changed ES6 to Typescript).

When I tried to run the app by executing

au run --watch
, it gave me this error:

ReferenceError: define is not defined
at Object.<anonymous> (/aurelia_project/tasks/build.js:1:63)

Investigating further, when I opened
directory, I found that all the
files are filled with
cannot find module
errors. For example,

[ts] Cannot find module 'gulp'.
[ts] Cannot find module 'aurelia-cli'.

and so on..

Do I have to execute some additional step for
typescript cli
ot resolve these modules?

Here is the
if that helps:

"compileOnSave": false,
"compilerOptions": {
"sourceMap": true,
"target": "es5",
"module": "amd",
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"lib": ["es2015", "dom"]
"exclude": [
"filesGlob": [
"atom": {
"rewriteTsconfig": false

Answer Source

Delete all the *.js files inside aurelia_json/tasks. Then repeat au run --watch.

Why? You have mistakenly transpiled your aurelia_json/tasks TypeScript into JavaScript, which you do not want to do, because the Aurelia CLI uses gulp-typescript. Delete all the *.js files inside aurelia_json/tasks and you will be fine.

The problem is unrelated to type definitions. As Meirion Hughes commented, the TypeScript compiler works without them.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download