我试图建立继Aurelia大街首页here视频教程基本奥里利亚项目。我想我已经遵循了视频中给出的确切步骤(只是将ES6更改为Typescript)。奥里利亚CLI +打字稿:找不到模块的错误
当我试图通过执行au run --watch
运行应用程序,它给了我这个错误:
ReferenceError: define is not defined
at Object.<anonymous> (/aurelia_project/tasks/build.js:1:63)
进一步调查,当我打开aurelia_project
目录,我发现所有的.ts
文件都充满了cannot find module
错误。例如,
[ts] Cannot find module 'gulp'.
[ts] Cannot find module 'aurelia-cli'.
等..
我一定要为执行一些typescript cli
额外的步骤OT解决这些模块?
这里是tsconfig.json
是否有帮助:
{
"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": [
"node_modules",
"aurelia_project"
],
"filesGlob": [
"./src/**/*.ts",
"./test/**/*.ts",
"./typings/index.d.ts",
"./custom_typings/**/*.d.ts"
],
"atom": {
"rewriteTsconfig": false
}
}
如果你已经做了一个简单的cli项目,并在dep安装和'au run'后得到那个错误消息,那么一些东西是错误的。无论是在旧的nodejs版本上,还是只安装了您所安装的cli版本中的错误。其次,'aurelia_project'文件夹的类型没有设置;但会编译得很好。如果你想要正确的类型,那么你需要为使用的吞咽模块安装类型。例如在tsconfig中设置“moduleResolution”:“node”,然后在'npm install @ types/gulp --save-dev'中输入类型。 –