从 teamcity 构建 ionic angular 应用程序时失败,但在其他任何地方都成功

Building ionic angular app fails when built from teamcity but succeeds every where else

我们正在开发一个新的 angular ionic 应用程序,它在我们所有的机器上从 powershell 构建,但在我们的构建机器上,当它从 perforce 将文件拉到我们的 D: 驱动器时,它无法构建。我们的构建机器正在使用 teamcity,我们正在使用 powershell 构建步骤来 运行 我们的 ng 命令。我可以获取完全相同的文件,如果我将 powershell 脚本明确指向它们,它们就会构建(我什至在执行此操作之前删除了 node_modules)。

这是我们得到的错误。我删除了路径中与我们的构建机器相关的部分以使其更清洁。

ERROR in ./src/global.scss (<path to application>/node_modules/css-loader/dist/cjs.js??ref--13-1!<path to application>/node_modules/postcss-loader/src??embedded!/node_modules/sass-loader/dist/cjs.js??ref--13-3!./src/global.scss)
Module build failed (from <path to application>/node_modules/postcss-loader/src/index.js):
Error: Failed to find '@ionic/angular/css/core.css'
  in [
    <path to application>\projects\ta\src
   ]
   at resolveModule.catch.catch (<path to application>\node_modules\postcss-import\lib\resolve-id.js:35:13)
@ ./src/global.scss 2:26-225
@ multi ./src/theme/variables.scss ./src/global.scss ./src/theme/site.scss

我检查了 @ionic/angular/css/core.css 文件是否真的丢失了,它在 node_modules 中,即使找不到它。

我们使用下面的命令来构建

ng run ta:build --verbose

我们正在使用以下版本的各种软件

我不太熟悉构建 angular 应用程序,所以如果您需要我提供其他信息,请提醒我,我可以提供。

{
   "name": "tenantapp",
   "version": "0.0.1",
   "author": "Ionic Framework",
   "homepage": "https://ionicframework.com/",
   "scripts": {
      "ng": "ng",
      "start": "ng serve",
      "build": "ng build",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e",
      "start:ta": "node --max-old-space-size=8192 \"node_modules\@angular\cli\bin\ng\" serve ta --open",
      "build:ionic": "ionic build"
   },
   "private": true,
   "dependencies": {
      "@angular/animations": "^10.0.9",
      "@angular/cdk": "^10.1.3",
      "@angular/common": "~9.1.6",
      "@angular/core": "~9.1.6",
      "@angular/forms": "~9.1.6",
      "@angular/material": "^10.1.3",
      "@angular/platform-browser": "~9.1.6",
      "@angular/platform-browser-dynamic": "~9.1.6",
      "@angular/router": "~9.1.6",
      "@angular/service-worker": "~9.1.6",
      "@capacitor/android": "^2.3.0",
      "@capacitor/core": "2.3.0",
      "@capacitor/ios": "^2.3.0",
      "@ionic-native/core": "^5.0.7",
      "@ionic-native/splash-screen": "^5.0.0",
      "@ionic-native/status-bar": "^5.0.0",
      "@ionic/angular": "^5.0.0",
      "@ionic/cli": "^6.12.1",
      "@ionic/pwa-elements": "^3.0.1",
      "fibers": "^3.1.0",
      "ng-recaptcha": "^6.0.2",
      "node-sass": "^4.14.1",
      "primeng": "^10.0.0-rc.3",
      "rxjs": "^6.5.5",
      "tslib": "^1.10.0",
      "zone.js": "~0.10.2"
   },
   "devDependencies": {
      "@angular-devkit/build-angular": "~0.901.5",
      "@angular/cli": "~9.1.5",
      "@angular/compiler": "~9.1.6",
      "@angular/compiler-cli": "~9.1.6",
      "@angular/language-service": "~9.1.6",
      "@capacitor/cli": "2.3.0",
      "@ionic/angular-toolkit": "^2.1.1",
      "@types/jasmine": "~3.5.0",
      "@types/jasminewd2": "~2.0.3",
      "@types/node": "^12.11.1",
      "codelyzer": "^5.1.2",
      "jasmine-core": "~3.5.0",
      "jasmine-spec-reporter": "~4.2.1",
      "karma": "~5.0.0",
      "karma-chrome-launcher": "~3.1.0",
      "karma-coverage-istanbul-reporter": "~2.1.0",
      "karma-jasmine": "~3.0.1",
      "karma-jasmine-html-reporter": "^1.4.2",
      "protractor": "~5.4.3",
      "ts-node": "~8.3.0",
      "tslint": "~6.1.0",
      "typescript": "~3.8.3"
   },
   "description": "An Ionic project"
}

编辑: 我在最初的问题中没有提到这一点,但 D: 驱动器是一个 ram 磁盘。最终,这最终成为非常重要的信息,我更新了问题以包括这个和 ramdisk 标签,希望其他人将来能比我更快地找到这个解决方案。

如果你构建 ionic 运行 也创建构建脚本 运行 这些命令也登录构建 服务器和手动构建相同的地方

Ionic cordova platform add android/ios
ionic cordova build ios/android --prod --release

我们最终能够通过调试 fs.js 找到问题,我们会收到以下错误。这个错误是在较低级别捕获的,我们只在我的问题中得到了错误,而没有调试到 fs.js.

EISDIR: illegal operation on a directory

我们 运行 遇到的问题是因为我们的 D: 驱动器是使用名为 ImDisk. The ImDisk utility apparently produces a drive which does not match some of the conditions fs.js checks to see if it can interact with the directory. We switched to using aim_ll.exe because of this comment on this github issue 的应用程序制作的,许多人报告了 ImDisk 的问题,但没有太多关于 ImDisk 功能的信息不同于 aim_ll.exe.