所以我遇到的问题是每次创建新组件后,我都必须记住将它的.less样式表添加到angular-cli.json文件中。我真正想要的是以某种方式告诉 angular 只重建.lesssrc 中的所有文件。我尝试做这样的事情:
{
"apps": [
{
...
"styles": [
"**/*.less"
],
...
}
]
}
Run Code Online (Sandbox Code Playgroud)
但我得到
module not found error
有什么帮助吗?
我有一个大型项目,直到现在都在 webpack 上运行,并且在 angular@4.3.3 上运行良好。今天我计划将其转移到 ng-cli 以利用通用等功能。一切都运行良好,除了当我尝试在 prod/prod+aot 中构建项目时,我得到:最大调用堆栈大小超出。
检查了问题的各个地方,大多数人都告诉检查循环依赖。但是根据最新的 cli@1.2.7,循环依赖应该显示为构建时间,但事实并非如此。我计划增加节点虚拟机堆栈的大小,但无法实现。我不想使用 ng 弹出并再次陷入 webpack 的混乱中。
cli@1.2.7 还有其他一些方法或解决方案吗
谢谢
包.json
{
"name": "test-project",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~4.3.3",
"@angular/compiler": "~4.3.3",
"@angular/core": "~4.3.3",
"@angular/forms": "~4.3.3",
"@angular/http": "~4.3.3",
"@angular/animations": "~4.3.3",
"@angular/flex-layout": "^2.0.0-beta.8",
"@angular/material": "^2.0.0-beta.8",
"@angular/cdk": "^2.0.0-beta.8",
"@angular/platform-browser": "~4.3.3",
"@angular/platform-browser-dynamic": "~4.3.3",
"@angular/platform-server": "~4.3.3",
"@angular/router": "~4.3.3",
"angular2-highcharts": "~0.5.5",
"@types/highcharts": "~4.2.57", …Run Code Online (Sandbox Code Playgroud) 我目前now.sh用于部署我的应用程序。最近,我决定将baseUrlfor 请求移到一个proxy.config.json文件中。
{
"/api/*": {
"target": "http://localhost:3000",
"secure": false,
"logLevel": "debug"
}
}
Run Code Online (Sandbox Code Playgroud)
为了部署,now.sh我将scriptsin更改package.json为:
"start": "serve dist/ --single",
"build": "ng build --prod",
Run Code Online (Sandbox Code Playgroud)
所以,首先,我做了一个ng build.
问题是,我需要一个不同的targetfor proxy.config.json,因为我部署了一个 API 并且我想在生产应用程序中使用它
我正在考虑拥有两个文件proxy.config.dev.json和proxy.config.prod.json,但我不知道是否可以使用cli. 问题是,我使用serve的生产和不ng serve那么proxy-config不可用。
你有什么建议?我怎样才能开始工作?
我有一个由 angular-cli 生成的组件,.ts 文件的结果代码有:
ngOnInit() {
}
Run Code Online (Sandbox Code Playgroud)
代替
ngOnInit(): void {
}
Run Code Online (Sandbox Code Playgroud)
我的 tslint 被配置为总是希望存在 typedef,但 cli 生成的代码没有 typedef - 这是我的问题。
有没有办法将 cli 配置为始终设置所需的 typedef,或者我唯一的选择是禁用此 tslint 检查或手动修复它?
我正在创建我的第一个 MEAN 应用程序。我已经安装了 angular CLI 并使用ng serve -o此命令对其进行了测试,然后我使用ng build它构建了应用程序,这也成功了。
现在,当我尝试安装“express”和“body-parser”时,出现以下错误
ENOTEMPTY: directory not empty, rmdir '/media/iconflux/DATA/vinit/Mean/meanApp/node_modules/fsevents/node_modules/dashdash/node_modules/assert-plus'
Run Code Online (Sandbox Code Playgroud)
我检查了目录它是空的。我也尝试手动删除目录,但仍然没有成功。
这是我用来安装 express 和 body-parser 的命令
npm install --save express body-parser
Run Code Online (Sandbox Code Playgroud)
注意:我正在使用 ubuntu 14.0
任何帮助将不胜感激谢谢。
我们刚刚将我们的 Angular 应用程序从流行的 webpack 种子转换为 CLI。
我们正在 Bamboo 中设置应用程序的版本号。此版本号与其他变量一起暴露在环境变量中。过去我们使用 process.env 和 webpack.DefinePlugin 来捕获这些变量并在构建时在应用程序中设置它们。
所以,它看起来像这样:
new webpack.DefinePlugin({
'process.env' : {
VERSION: JSON.stringify((process.env.bamboo_versionNumber || '') + '.' +
(process.env.bamboo_buildNumber || '') +
(process.env.bamboo_buildType || ''))
}
})
Run Code Online (Sandbox Code Playgroud)
然后在 TS 代码中:
this.appVersion = process.env.VERSION;
Run Code Online (Sandbox Code Playgroud)
这允许我们向用户显示版本号以及来自 Bamboo 的任何其他信息......
似乎无法使用 CLI 配置 Webpack ......
我们如何使用 Angular CLI 实现这一点?有没有办法在构建时将 Bamboo 公开的环境变量传递到我们的应用程序中?
尝试构建我的应用程序时出现这个新错误。我什至不知道从哪里开始。错误很大,让我认为这是许多软件包的共同之处?
可能值得注意的是,@angular/tsc-wrapped autoprefixer由于我看到的另一个错误,我在此之前安装了一个软件包。在angular-cligithub 问题上,我看到人们用那个包解决了这个问题。
附带说明,第一个错误:
Error: ./node_modules/chart.js/src/core/core.helpers.js Module not found:
Run Code Online (Sandbox Code Playgroud)
当我查看我的node_modules文件夹时,我看到了那个确切的文件?它存在时是否有理由找不到它?
[18:10:50] ionic-app-script task: "build"
[18:10:50] Error: ./node_modules/chart.js/src/core/core.helpers.js Module not found: Error: Can't resolve
'chartjs-color' in '/usr/src/app/node_modules/chart.js/src/core' resolve 'chartjs-color' in
'/usr/src/app/node_modules/chart.js/src/core' Parsed request is a module using description file:
/usr/src/app/node_modules/chart.js/package.json (relative path: ./src/core) Field 'browser' doesn't contain
a valid alias configuration after using description file: /usr/src/app/node_modules/chart.js/package.json
(relative path: ./src/core) resolve as module looking for modules in /usr/src/app/node_modules using
description file: /usr/src/app/package.json (relative path: ./node_modules) …Run Code Online (Sandbox Code Playgroud) 我是 AngularJS 的新手,刚刚开始在线课程。
我正在尝试在运行 Windows 7 的计算机上安装 angular CLI。我以管理员身份打开命令行并运行npm install -g @angular/cli. 安装开始,几分钟后我收到一个错误:

I see the notification "operation not permitted", but I am the administrator of the computer and the command line I run as administrator.
What am I doing wrong? The same installation I did on my laptop at home and it was successful.
I am checking with our IT support about other possible causes and will appreciate any help.
This is not a duplicate of Fail …
我有一个带有打字稿文件 (.ts) 的共享文件夹(符号链接),我希望它们被构建并随后添加到我的 dist 文件夹中。
如果我将每个文件名都放在“angular-cli.json”中的脚本部分,如下所示:
...
"scripts": [
"app/shared/Scripts.Shared/IConstructableFromString.ts",
"app/shared/Scripts.Shared/User.ts"
],
...
Run Code Online (Sandbox Code Playgroud)
有用。但是当我尝试像这样添加完整的文件夹时:
...
"scripts": [
"app/shared/Scripts.Shared/**"
],
...
Run Code Online (Sandbox Code Playgroud)
出现以下错误:
Error: ENOENT: no such file or directory, open 'C:\project\src\app\shared\Scripts.Shared\**'
Run Code Online (Sandbox Code Playgroud)
我的问题:
是否可以添加一个完整的文件夹(例如使用通配符“*”)或者是否有其他解决方案?
提前致谢,丹尼尔
我试图在我的 http 调用中放置一个进度条,但是我无法发出同步 HTTP 调用请求,而是以异步方式进行。
下面是进行http调用的函数
public authenticationt2cHTTP(email, password) {
console.log("authenticationt2cHTTP WITH HEADERS");
const body = new HttpParams()
.set('email', email)
.set('password', password);
const req = new HttpRequest('POST', 'http://192.168.0.135:8080/rest/auth/login', body, {
reportProgress: true,
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
});
this.http.request(req).subscribe(event => {
// Via this API, you get access to the raw event stream.
// Look for upload progress events.
if (event.type === HttpEventType.UploadProgress) {
// This is an upload progress event. Compute and show the % done:
const percentDone = Math.round(100 …Run Code Online (Sandbox Code Playgroud) angular-cli ×10
angular ×6
node.js ×2
typescript ×2
angular5 ×1
angularjs ×1
aot ×1
express ×1
javascript ×1
json ×1
mean-stack ×1
npm ×1
npm-install ×1
rest ×1
tslint ×1