标签: angular-cli

Atlassian 管道和 Angular CLI

尝试使用 Angular CLI 设置管道并在调用ng build.

pipelines:
   default:
     - step:
        script: # Modify the commands below to build your repository.
          - npm --version
          - npm install
          - ng build
Run Code Online (Sandbox Code Playgroud)

angular-cli 是我的 package.json 中的一个开发依赖项,但找不到 ng。

bash: ng: command not found
Run Code Online (Sandbox Code Playgroud)

我错过了什么步骤或做错了什么?谢谢

angular-cli bitbucket-pipelines

5
推荐指数
1
解决办法
2584
查看次数

如何发布到github页面?

我无法理解有关发布到github页面的一些基本指令.有一种新方法可以发布使用Angular Cli制作的Angular项目; 我按照新页面上的指示操作,angular-cli-ghpages:

Execute angular-cli-ghpages in order to deploy the project with a build from dist folder.
Note: you have to create the dist folder in before (e.g. ng build --prod)

Usage:

ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY/"
angular-cli-ghpages [OPTIONS]
Run Code Online (Sandbox Code Playgroud)

我为我的项目创建了一个dist文件夹,然后运行ng构建代码.终端显示已渲染的所有块,但我找不到github页面的链接.我在github上查看我的存储库,就好像什么也没发生过一样.这是因为我需要cd到一个特定的文件夹来执行angular-cli-ghpages吗?这是我的回购,我非常感谢任何帮助.

github-pages angular-cli angular

5
推荐指数
1
解决办法
2462
查看次数

无法从VSTS代理运行'ng'

我正在尝试使用托管的VSTS构建代理对我们的AngularCLI项目运行单元测试,但是当它尝试运行'ng test'时它一直遇到麻烦.

为了解决这个问题,我尝试通过提供工具的路径,使代理直接使用ng工具.这没有用,因为它看起来像是在尝试运行'ng test'工具而不是在指定的当前工作目录中:

在此输入图像描述

在此输入图像描述

我还尝试将其添加为Windows中的环境变量(我们使用Windows Server 2012来托管VSTS代理)并在VSTS代理中设置工具,ng但它似乎没有找到ng工具:

在此输入图像描述 在此输入图像描述

如何让VSTS代理使用该ng工具运行测试?我们在托管代理的服务器上安装了@ angular/cli.

build azure-devops angular-cli

5
推荐指数
1
解决办法
1723
查看次数

如何使用angular-cli 4构建一次并部署多个环境?

我们计划将角度部署到亚马逊S3静态网站,目前我们正在为每个环境(开发/生产)进行单独构建.是否可以构建一次并部署到所有环境的任何解决方案.

提前致谢.

angular-cli angular

5
推荐指数
1
解决办法
2822
查看次数

Angular CLI:使用proxy.conf.json的代理websocket

我试图使用ng serve --proxy-config proxy.conf.jsonAngular CLI 代理websockets ,但由于我收到此错误,因此无法使其工作:

WebSocket connection to 'ws://stream/connect' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED

以下是我实例化websocket和我的代理配置的方法:

// WebSocket instantiation
const ws = new WebSocket('ws://stream/connect');

// proxy.conf.json
"stream/**": {
  "target": "wss://someurl.com:443",
  "secure": false,
  "ws": true
}
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?这似乎是可行的,但我不能让它正常工作!

这个封闭的问题https://github.com/angular/angular-cli/issues/6081没有帮助这个stackoverflow答案.

proxy websocket angular-cli angular

5
推荐指数
1
解决办法
2166
查看次数

Angular CLI webpack公共路径未更新

我正在使用角度cli和webpack.我有一个代码在运行时更改变量webpack_require .p但是当应用程序编译scss文件时没有使用webpack_require .p的新值并且css中的图像没有加载.

这个工作与angular cli版本1.6.7很好,但现在我使用的是版本1.7.2并且无法正常工作:下面是我的代码:

declare var __webpack_require__: any;

__webpack_require__.p = newValue;
Run Code Online (Sandbox Code Playgroud)

我的scss文件如下所示:

.className {
background: url(../../../dir1/dir2/images/imageName.jpg) no-repeat; }
Run Code Online (Sandbox Code Playgroud)

更新:使用CLI版本1.7.3无法解决问题.其他资源工作得很好但不是scss背景url图像.

css sass webpack angular-cli angular

5
推荐指数
0
解决办法
401
查看次数

更新到Angular 6后,ng new已停止工作

今天,我将我的角度cli更新为最新版本,并遇到一个错误,阻止我创建一个新的Angular项目.以下是执行后得到的错误日志ng new app-name:

Error: Schematic "ng-new" not found in collection "@schematics/angular".
    at SchematicEngine.createSchematic (C:\Users\xyz\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\engine.js:155:23)
    at CollectionImpl.createSchematic (C:\Users\xyz\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\collection.js:12:29)
    at NodeWorkflow.execute (C:\Users\xyz\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\workflow\node-workflow.js:70:38)
    at Promise (C:\Users\xyz\node_modules\@angular\cli\models\schematic-command.js:141:22)
    at new Promise (<anonymous>)
    at NewCommand.runSchematic (C:\Users\xyz\node_modules\@angular\cli\models\schematic-command.js:140:16)
    at NewCommand.<anonymous> (C:\Users\xyz\node_modules\@angular\cli\commands\new.js:77:25)
    at Generator.next (<anonymous>)
    at C:\Users\xyz\node_modules\@angular\cli\commands\new.js:7:71
    at new Promise (<anonymous>)
Run Code Online (Sandbox Code Playgroud)

为了解决这个问题,我已经重新安装了角度cli以及npm两次以上.包的版本如下:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.0
@angular-devkit/core         0.6.0
@angular-devkit/schematics   0.6.0
@schematics/angular          0.6.0
@schematics/update           0.6.0
rxjs                         6.1.0
Angular Cli                  6.0.0
Node                         8.11.1
npm                          5.6.0
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激.

编辑:我从安装角度全局包的地方运行new,我可以从那里创建一个应用程序.从其他任何地方运行它会产生错误.

angular-cli angular angular-cli-v6

5
推荐指数
1
解决办法
5690
查看次数

TypeError - o.ngOnDestroy不是函数

构建我的角度应用程序进行生产时(ng服务没有问题)我在加载其中一个子模块时遇到以下错误:

ERROR Error: Uncaught (in promise): TypeError: o.ngOnDestroy is not a function
TypeError: o.ngOnDestroy is not a function
    at Fi (core.js.pre-build-optimizer.js:9573)
    at Mi (core.js.pre-build-optimizer.js:9541)
    at Ri (core.js.pre-build-optimizer.js:9531)
    at fo (core.js.pre-build-optimizer.js:10593)
    at go (core.js.pre-build-optimizer.js:10719)
    at vo (core.js.pre-build-optimizer.js:10662)
    at fo (core.js.pre-build-optimizer.js:10591)
    at go (core.js.pre-build-optimizer.js:10719)
    at mo (core.js.pre-build-optimizer.js:10641)
    at fo (core.js.pre-build-optimizer.js:10592)
    at Fi (core.js.pre-build-optimizer.js:9573)
    at Mi (core.js.pre-build-optimizer.js:9541)
    at Ri (core.js.pre-build-optimizer.js:9531)
    at fo (core.js.pre-build-optimizer.js:10593)
    at go (core.js.pre-build-optimizer.js:10719)
    at vo (core.js.pre-build-optimizer.js:10662)
    at fo (core.js.pre-build-optimizer.js:10591)
    at go (core.js.pre-build-optimizer.js:10719)
    at mo (core.js.pre-build-optimizer.js:10641)
    at fo (core.js.pre-build-optimizer.js:10592)
    at P …
Run Code Online (Sandbox Code Playgroud)

angular-cli angular

5
推荐指数
1
解决办法
1054
查看次数

angular 7.0.5 ng new不会询问您是否要添加Angular路由?

有人可以指导我了解为什么我无法使用新版本的angular 7生成新项目

所需结果:

在此处输入图片说明

ng new firebase-auth?您想添加角度路由吗?不是吗 您想使用哪种样式表格式?的CSS

获得的结果:

 $ ng new appAtlas
    CREATE appAtlas/angular.json (3786 bytes)
    CREATE appAtlas/package.json (1316 bytes)
    CREATE appAtlas/README.md (1025 bytes)
    CREATE appAtlas/tsconfig.json (408 bytes)
    CREATE appAtlas/tslint.json (2837 bytes)
    CREATE appAtlas/.editorconfig (245 bytes)
    CREATE appAtlas/.gitignore (503 bytes)
    CREATE appAtlas/src/favicon.ico (5430 bytes)
    ....
    CREATE appAtlas/e2e/src/app.po.ts (208 bytes)
    npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, fl                                   atted is its successor.
Run Code Online (Sandbox Code Playgroud)

Angular CLI版本

$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ …
Run Code Online (Sandbox Code Playgroud)

npm angular-cli angular angular7

5
推荐指数
1
解决办法
5136
查看次数

无法在角度5到7更新后生成prod,terser错误

我有一个Angular-cli项目与Angular 5.2.我更新到Angular 7.2.3.一切都OK了,ng serve,ng test,但是当我想ng build --prod我得到的错误

我一步一步地按照指南(https://update.angular.io/)

以下是错误:

ERROR in runtime.82c6613acef8f7246fe8.js from Terser
TypeError: Cannot read property 'minify' of undefined
    at minify (/Users/nicolasgarin/Desktop/afreecom/front/node_modules/terser-webpack-plugin/dist/minify.js:175:23)
    at module.exports (/Users/nicolasgarin/Desktop/afreecom/front/node_modules/terser-webpack-plugin/dist/worker.js:13:40)
    at handle (/Users/nicolasgarin/Desktop/afreecom/front/node_modules/worker-farm/lib/child/index.js:44:8)
    at process.<anonymous> (/Users/nicolasgarin/Desktop/afreecom/front/node_modules/worker-farm/lib/child/index.js:51:3)
    at process.emit (events.js:180:13)
    at emit (internal/child_process.js:783:12)
    at process._tickCallback (internal/process/next_tick.js:178:19)
ERROR in main.ae88265d57a522e8fef6.js from Terser
TypeError: Cannot read property 'minify' of undefined
    at minify (/Users/nicolasgarin/Desktop/afreecom/front/node_modules/terser-webpack-plugin/dist/minify.js:175:23)
    at module.exports (/Users/nicolasgarin/Desktop/afreecom/front/node_modules/terser-webpack-plugin/dist/worker.js:13:40)
    at handle (/Users/nicolasgarin/Desktop/afreecom/front/node_modules/worker-farm/lib/child/index.js:44:8)
    at process.<anonymous> (/Users/nicolasgarin/Desktop/afreecom/front/node_modules/worker-farm/lib/child/index.js:51:3)
    at process.emit (events.js:180:13)
    at emit (internal/child_process.js:783:12) …
Run Code Online (Sandbox Code Playgroud)

updates angular-cli

5
推荐指数
1
解决办法
934
查看次数