- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
当我使用命令 npm run build -- --prod 时,我收到以下错误消息:
ERROR in src\app\components\app\app.component.html(77,56): : Property 'validate' is private and only accessible within class 'AppComponent'. src\app\components\entitysearchlight\entitysearchlight.component.html(3,157): : Property 'loadingMessage' is private and only accessible within class 'EntitySearchLightComponent'. src\app\components\entitysearchlight\entitysearchlight.component.html(23,91): : Expected 0 arguments, but got 1. src\app\components\entitysearchlight\entitysearchlight.component.html(97,62): : Property 'e' does not exist on type 'EntitySearchLightComponent'. src\app\components\search\search.component.html(3,157): : Property 'loadingMessage' is private and only accessible within class 'SearchComponent'. src\app\components\search\search.component.html(23,91): : Expected 0 arguments, but got 1. src\app\components\search\search.component.html(57,43): : Property 'onFilterItemSelect' is private and only accessible within class 'SearchComponent'. src\app\components\search\search.component.html(90,58): : Property 'e' does not exist on type 'SearchComponent'.
当我运行时,相同的应用程序成功构建:npm run build --env=prod
您能否告诉我这两个命令如何导致构建过程或配置发生变化?
最佳答案
正如上面所写,您需要将访问修饰符 private
更改为 public
。您有一些必要的小文件。但是,您需要避免功能上的问题。
我建议使用 tslint 并检查您的代码。添加tslint.json
新规则
"rules": {
...
"member-access": true,
并在各处添加访问修饰符。
在package.json
中创建命令,您可以在其中检查构建
"scripts": {
"lint": "ng lint",
...
"building:prod": "npm i && ng lint && ng build --prod"
},
关于jquery - 将应用程序迁移到 Angular 6 : But getting errors while running npm run build --prod. 但命令 npm run build --env=prod 成功运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54983825/
我是一名优秀的程序员,十分优秀!