按照 Devextreme 的官方文档, 首次使用 devextreme
1 创建 Angular项目,
ng new test
2 安装 devextreme
npm install --save devextreme devextreme-angular
3 在 app.module.ts 引用一个按钮
import { DxButtonModule } from "devextreme-angular";
@NgModule({ ... imports: [ ... DxButtonModule, ... ] }) export class AppModule {}
4 执行 ng serve 然后出错了
ERROR in ./node_modules/jszip/lib/readable-stream-browser.js
Module not found: Error: Can't resolve 'stream' in 'D:\Project\Work\Quotes2\quotes\node_modules\jszip\lib'
查找错误原因, 找到官方的解决方案
{ ... "compilerOptions": { ... "paths": { "jszip": [ "node_modules/jszip/dist/jszip.min.js" ] } } }
至此问题解决, 编译通过.
This project was generated with Angular CLI version 6.1.2.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.