Angular CLI 9 - 无法复制资产:EFAULT:系统调用参数中的错误地址,copyfile

Posted

技术标签:

【中文标题】Angular CLI 9 - 无法复制资产:EFAULT:系统调用参数中的错误地址,copyfile【英文标题】:Angular CLI 9 - Unable to copy assets: EFAULT: bad address in system call argument, copyfile 【发布时间】:2020-06-15 11:49:58 【问题描述】:

我正在 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",

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

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

【问题讨论】:

【参考方案1】:

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

【讨论】:

以上是关于Angular CLI 9 - 无法复制资产:EFAULT:系统调用参数中的错误地址,copyfile的主要内容,如果未能解决你的问题,请参考以下文章

安装nodejs后无法安装@angular/cli@9.1.8

无法显示 Angular 下资产部分中列出的某些图像

关于资产优化的 Angular-cli 'JavaScript heap out of memory'

Angular-CLI 和 dotnet cli 如何编写命令同时观看? [复制]

ng serve 和 ng build 的 cli config 中的不同资产 [Angular 5]

当我使用最新的 angular-cli(beta 15 w/webpack)运行 ng test 时,如何提供资产?