标签: angular-cli-v8

ng build 时超出调用重试次数异常

我正面临一个异常ng build(为差异加载生成 ES5 包......)

An unhandled exception occured: Call retires were exceeded
Run Code Online (Sandbox Code Playgroud)

使用过的版本:

  • 角CLI: 8.3.20
  • 角度: 8.2.7
  • 节点: 12.12.1

同样在日志中,它被提到

[error] Error: Call retries were exceeded at ChildProcessWorker.initialize
Run Code Online (Sandbox Code Playgroud)

angular-cli angular ng-build angular8 angular-cli-v8

63
推荐指数
4
解决办法
5万
查看次数

在 Angular 库中保留符号链接

我有个问题。

我正在尝试使用 ng-cli 创建一个 Angular 8 库,但我无法使用npm link.

我试图在我的 angular.json 上添加这个:

    "build": {
      "builder": "@angular-devkit/build-ng-packagr:build",
      "options": {
        "preserveSymlinks": true,
        "tsConfig": "projects/button/tsconfig.lib.json",
        "project": "projects/button/ng-package.json"
      }
    }, 
Run Code Online (Sandbox Code Playgroud)

但得到:

"Schema validation failed with the following errors: Data path ""
should NOT have additional properties(preserveSymlinks)."
Run Code Online (Sandbox Code Playgroud)

我发现它不适用于图书馆。

然后我尝试将其添加到我的 tsconfig.lib.json 中:

 "angularCompilerOptions": {
    "annotateForClosureCompiler": true,
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableResourceInlining": true,
    "preserveSymlinks": true
  }
Run Code Online (Sandbox Code Playgroud)

什么也没发生。

我在这里搜索了一个解决方案,但找不到类似的东西。

我怎样才能做到?

谢谢!

npm npm-link angular angular8 angular-cli-v8

13
推荐指数
1
解决办法
1万
查看次数

Angular 8:对象不支持属性或方法“包含”

我正在 angular8 中构建一个应用程序。我在 angular5/6/7 上工作,对于那些应用程序,我取消了对 polyfills.ts 中存在的导入的注释。对于 angular 8,它只有 3 个导入,即 classlist.js、web-animation-js 和 zone.js/dist/zone。我的应用程序在 IE 中运行良好。但是我开始使用包含功能来查看项目是否存在。它在 chrome 中运行良好。在 IE 中,它抛出 Object 不支持属性或方法 'includes' 错误。

angular angular8 angular-cli-v8

7
推荐指数
2
解决办法
9859
查看次数

vscode ng 服务一次又一次编译

在 Windows 10 上,ngserve 会一次又一次地进行编译,而不保存任何更改。即使当我在 vscode 中的两个文件之间切换时,它也会重新编译。

但是当我在 macOS 上运行相同的 Angular 项目时,它的行为正常。

npm angular-cli angular angular8 angular-cli-v8

6
推荐指数
0
解决办法
2256
查看次数

BrowserslistError: Unknown version 67 of android

I have created one angular library using angular 8 and CLI 8. I am trying to build the library, but I am getting the error.

ng build <lib-name>
Run Code Online (Sandbox Code Playgroud)

I have gone through some questions posted related to this error, most of them say remove node_modules and reinstall them. I tried this solution but still, I am getting the following error.

[Browserslist] Could not parse package.json. Ignoring it.

ERROR: Unknown version 67 of android
Unknown version 67 of android
BrowserslistError: …
Run Code Online (Sandbox Code Playgroud)

javascript angular angular-library angular-cli-v8

5
推荐指数
2
解决办法
957
查看次数

在angular8升级中将public_api.ts重命名为public-api.ts时如何修复ng build &lt;lib&gt;错误

我正在为我公司的组件库迁移 angular 7 到 angular 8,该组件库是用“ng generate library”构建的。我试图尽可能接近标准的 angular cli 构建。我创建了一个全新的应用程序和一个带有“@angular/cli”:“~8.2.0”的库。

https://github.com/Annie-Huang/my-angular8-app/tree/create-lib

我注意到在 angular 8 中,他们将 public_api.ts 更改为 public-api.ts https://github.com/Annie-Huang/my-angular8-app/blob/create-lib/projects/ea-ui/src/public -api.ts

所以我将现有库中的入口文件从 public_api.ts 重命名为 public-api.ts 并在 ng-package.json 中更新它

我得到这个错误

Bradleys-MacBook-Pro:ea-component-library anniehuang$ ng build ea-ui
Building Angular Package
ERROR: error TS6053: File '/Users/anniehuang/projects/ea-component-library/projects/ea-ui/src/public_api.ts' not found.

An unhandled exception occurred: error TS6053: File '/Users/anniehuang/projects/ea-component-library/projects/ea-ui/src/public_api.ts' not found.

See "/private/var/folders/sw/1rxh903n6y39kkwbgr737n8m0000gp/T/ng-SE3jbI/angular-errors.log" for further details.
Run Code Online (Sandbox Code Playgroud)

当我在我自己的 repo ( ng build ea-ui)中的全新 angular 8 应用程序中构建它时。我没有这个错误。

而且我在公司组件库上进行全局搜索时没有public_api.ts字符串。

ng-package.json:
---------------------
{
  "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
  "dest": "../../dist/ea-ui",
  "lib": {
    "entryFile": …
Run Code Online (Sandbox Code Playgroud)

angular-library angular8 angular-cli-v8

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

Angular Firebase 函数部署错误:找不到模块“firebase/app”

我在我的 Angular Firebase 项目中添加了 SSR 并设置了 WPA。并且它成功地部署在 Firebase(托管和功能)上。但是下次我在组件中编辑了一些代码。在那之后,我正在重新部署。firebase 托管已成功部署。但函数显示错误。

我在 package.json 中使用了 Angular 8 和所有最新的 npm 包,我还更新并重建了我的项目。在 localhost:5000 上一切正常。

我得到的错误:加载用户代码时函数失败。错误消息:无法加载文件 lib/index.js 中的代码。

     Detailed stack trace: Error: Cannot find module 'firebase/app'
     at Function.Module._resolveFilename (module.js:548:15)
     at Function.Module._load (module.js:475:25)
     at Module.require (module.js:597:17)
     at require (internal/module.js:11:18)
     at webpackUniversalModuleDefinition (/srv/dist/server.js:3:28)
     at Object.<anonymous> (/srv/dist/server.js:10:3)
     at Module._compile (module.js:653:30)
     at Object.Module._extensions..js (module.js:664:10)
     at Module.load (module.js:566:32)
     at tryModuleLoad (module.js:506:12)
Run Code Online (Sandbox Code Playgroud)

和 package.json

  "node": "8"
  },
  "main": "lib/index.js",
  "dependencies": {
  "@firebase/app": "^0.4.15",
  "firebase-admin": "^8.0.0",
  "firebase-functions": "^3.1.0"
   },
   "devDependencies": {
   "tslint": "^5.12.0", …
Run Code Online (Sandbox Code Playgroud)

firebase server-side-rendering angular angular-cli-v8

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

Angular cli 显示错误“发生未处理的异常:没有项目支持‘测试’目标。” 运行 ng test 或 ng serve 命令时

我有一个基本的角度应用程序,它运行良好。在ng serveng test命令都工作正常。最近,作为针对不同环境构建自动化的一部分,我引入了一些配置更改以允许environment.ts根据环境加载不同的文件。对于我编辑的angular.jsonfile.After的变化,ng serveng test命令无法执行。每当执行命令时,都会抛出以下错误:

An unhandled exception occurred: No projects support the 'test' target.
See "C:\Users\account\AppData\Local\Temp\ng-BlbvgV\angular-errors.log" for further details.
Run Code Online (Sandbox Code Playgroud)

修改angular.json为:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "applicationui": {
      "projectType": "application",
      "schematics": {},
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "../applicationservice/src/main/resources/static",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "aot": false,
            "assets": [
              "src/favicon.ico",
              "src/assets" …
Run Code Online (Sandbox Code Playgroud)

build angular angular-test angular8 angular-cli-v8

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

Angular:本地化为多种语言

我有一个已经构建好的 Angular 6 应用程序。现在我们计划将其支持为多种语言。我能够创建多个 xlf 文件并将目标字符串替换为语言。我的语言环境文件有三个文件,如messages.en.xlf、messages.es.xlf 和messages.fr.xlf,每个文件分别用于英语、西班牙语和法语。

根据浏览器的语言,应用程序应选择所需的语言文件。如果浏览器设置为法语,它应该会自动提取 messages.fr.xlf 并以法语显示应用程序。

起初我的命令,会是ng build --prod --output-hashing all,但与定位的改变,我需要使用--aot=false,并--build-optimizer=false与我的应用程序的性能和加载时间变差。

ng build  --prod --output-hashing all --aot=false --build-optimizer=false
Run Code Online (Sandbox Code Playgroud)

我的 main.ts 文件如下所示:

ng build  --prod --output-hashing all --aot=false --build-optimizer=false
Run Code Online (Sandbox Code Playgroud)

我想知道是否有一种正确的方法可以根据浏览器的语言加载 xlf 文件而不会出现性能问题并且不会使 AOT 为假。

angular-cli angular-i18n angular angular-cli-v8

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

如何使用 Angular CLI 9 创建 Angular 8 项目

我正在使用 Angular CLI 9.1.1,但需要使用 Angular 8 创建一个项目。
我还有其他使用 Angular 9 的项目,所以我不想全局安装 Angular 8 CLI。

是否有任何选项可以使用 Angular CLI 9 创建 Angular 8 项目?

angular-cli angular angular-cli-v8 angular-cli-v9

0
推荐指数
1
解决办法
5987
查看次数