首页 > 解决方案 > Angular CLI 9 - 无法复制资产:EFAULT:系统调用参数中的错误地址,copyfile

问题描述

我正在 AngularJS (CLI 9) 框架中开发我的应用程序之一。

它通过命令成功运行ng serve并打开http://localhost:4200

但是当我构建它时,ng build我得到了以下错误

无法复制资产:EFAULT:系统调用参数中的错误地址,copyfile directoryPath/src/favicon.ico -> directoryPath/dist/favicon.ico

下面是我的构建代码..

"build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "aot": false,
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "./src/styles.scss",
              "./node_modules/bootstrap/scss/bootstrap.scss",
              "./node_modules/font-awesome/scss/font-awesome.scss",
              "./node_modules/admin-lte/build/scss/AdminLTE.scss",
              "./node_modules/@ng-select/ng-select/themes/ant.design.theme.css",
              "./node_modules/ngx-toastr/toastr.css"
            ],
            "stylePreprocessorOptions": {
              "includePaths": [
                "./node_modules"
              ]
            },
            "scripts": [
              "./node_modules/jquery/dist/jquery.js",
              "./node_modules/popper.js/dist/umd/popper.js",
              "./node_modules/bootstrap/dist/js/bootstrap.js",
              "./node_modules/jquery-slimscroll/jquery.slimscroll.js",
              "./node_modules/icheck/icheck.js",
              "./node_modules/fastclick/lib/fastclick.js",
              "./node_modules/admin-lte/dist/js/adminlte.js"
            ]
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        }

这是所有角度依赖

"dependencies": {
    "@angular/animations": "~9.0.0",
    "@angular/common": "~9.0.0",
    "@angular/compiler": "~9.0.0",
    "@angular/core": "~9.0.0",
    "@angular/forms": "~9.0.0",
    "@angular/platform-browser": "~9.0.0",
    "@angular/platform-browser-dynamic": "~9.0.0",
    "@angular/router": "~9.0.0"
},
"devDependencies": {
    "@angular-devkit/build-angular": "~0.900.1",
    "@angular/cli": "~9.0.1",
    "@angular/compiler-cli": "~9.0.0",
    "@angular/language-service": "~9.0.0",
}

我在谷歌上进行了研究,但我没有找到任何解决方案..

让我知道如何解决这个问题。

标签: angularng-build

解决方案


这是节点版本问题..我将节点版本10更新到12+然后解决了..


推荐阅读