我刚刚安装了angular-cli 1.0.0.beta.17(最新的一个),启动新项目,能够在端口4200上提供项目而没有任何问题 - 只需标准的"app works!" 信息.
但是,当我尝试使用命令构建生产这个空的通用应用程序时,ng build --prod我根本没有创建main.*.js文件,并且有几个警告屏幕,例如:
这是一个全新的空项目 - 我没有机会打破任何东西......
如何建立生产版本?
我正在创建一个新的 Angular 项目,并希望所有 Angular 依赖项都来自稳定的第 7 版本。但是,似乎在运行ng new app命令时 Angular 总是获取最新版本。我的 package.json 显示了来自~8.0.0.
我知道我可以修改 package.json 并将这些依赖项设置为按照语义 7.xx 获取,但我更希望它自动完成,这样我就不会遇到与任何对等依赖项不匹配的机会.
那么,有没有办法告诉 CLI 获取特定的 angular 版本以及根据该 angular 版本的所有依赖项。
编辑:我已经尝试过安装 @angular/cli@7.xx 即使在我运行 ng 新应用程序之后这样做,我的依赖也会按照第 8 版获取
我知道angular-cli使用了使用lint.js的codelyzer
使用命令时:
ng lint
它可以自动修复格式吗?或者它只会通知格式错误?
ng lint --help 输出angular-cli的所有帮助命令.
我有简单的angular2-cli应用程序(一页有模型驱动形式 - 不涉及路由器)."ng服务"一切正常.我用ng build --product制作了生产版本.我将所有./dist文件夹内容复制到C:\ inetpub\wwwroot下的新文件夹中.我从IIS管理控制台制作了虚拟应用程序.Defualt应用程序文件是index.html.我浏览到app uri,我只得到"正在加载..."的页面.我尝试没有--product开关(只有ng build)的构建,但结果是一样的.Angular app未加载.是否还需要在IIS上发布角度应用程序?
我尝试在Internet Explorer 11中运行由angular-cli 1.0.0构建的我的处女Angular 4应用程序,但是我没有成功,我收到以下错误:
Error: The "apply" property of an undefined or null reference can not be retrieved.
Run Code Online (Sandbox Code Playgroud)
我没有安装额外的库,它只是一个新生成的项目.在谷歌浏览器中它完美运行.我的package.json:
{
"name": "angi4testie",
"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.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0", …Run Code Online (Sandbox Code Playgroud) 我正在使用Angular CLI构建一个使用该--prod开关进行生产的应用程序.该包在dist目录中创建.有没有办法知道哪些类和函数在树形图形和所有其他步骤后实际放入了包中?
我今天开始从Angular 4.4.4升级到5.1.1.我不得不升级一些依赖于角度的其他软件包.我得到一个错误,上下文很少,我不知道从哪里开始.有没有其他人看过这个并知道问题是什么?
$ ng serve --aot=false
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2017-12-19T15:26:36.137Z
Hash: bf0b773d5dfafdd9133b
Time: 16934ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 2.93 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 636 bytes [initial] [rendered]
chunk {scripts} scripts.bundle.js (scripts) 307 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 4.03 MB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 855 kB [initial] [rendered]
ERROR in TypeError: Cannot read …Run Code Online (Sandbox Code Playgroud) 我用angular-cli在我们的一个项目中.现在,我们开始了解webpack.根据我的研究,webpack它比angular-cli它更快,它也删除了未使用的代码.我不知道有什么缺点.
我只是想知道哪一个更好地用于各种方式,如网站速度,更少的代码等.
我需要在angular2应用程序的页面上显示git revision.该项目基于angular-cli.
如何扩展构建,以便将git修订版放入environment.ts应用程序可访问的其他位置?
昨天我将 Angular CLI 和核心更新到 8.0.0v。之后,我成功初始化了一个新应用程序并运行了它。构建应用程序并在其上提供服务后,localhost:4200我打开控制台并出现错误:
ng.probe 不是函数
我试图研究这个问题,但没有相关信息。
实际结果:
ng serve / npm 启动后,控制台出现问题:
预期结果:
控制台没有错误
angular-cli ×10
angular ×8
angular4 ×1
build ×1
debugging ×1
iis ×1
javascript ×1
jslint ×1
npm ×1
package.json ×1
production ×1
publish ×1
tree-shaking ×1
webpack ×1