Ionic 从teamcity构建时构建离子Angular 应用程序失败,但在其他任何地方都成功

ruyhziif  于 2022-12-08  发布在  Ionic
关注(0)|答案(2)|浏览(132)

We are working on a new angular ionic app and it builds on all our machines from powershell but on our build machine when it pulls the files from perforce to our D: drive it fails to build. Our build machine is using teamcity and we are using the powershell build step to run our ng commands. I can take the exact same files and they will build if I point the powershell script to them explicitly (I even deleted node_modules before doing this).
Here is the error we get. I removed the parts of the path’s related to our build machine to keep it cleaner.

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

I checked if the @ionic/angular/css/core.css file was really missing and it was in the node_modules even when it fails to find it.
We use the following command to build

ng run ta:build --verbose

We are using the following versions of various pieces of software

  • Npm: 6.9.0
  • Angular CLI: 1.6.7
  • Node: 10.16.0

I am not very familiar with building angular apps so if there is other information you need from me give me the heads up and I can provide it.

{
   "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"
}

EDIT: I did not mention this in the initial question but the D: drive is a ram disk. Ultimately this ended up being very important information and I updated the question to include this and the ramdisk tag so hopefully others will find this solution quicker than I did in the future.

oknrviil

oknrviil1#

We were finally able to find the issue by debugging into fs.js where we would get the following error. This error was captured at a lower level and we only got the error in my question without debugging into fs.js.

EISDIR: illegal operation on a directory

The issue we ran into was because our D: drive was made using an application called 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 which has many people reporting the issue with ImDisk but not a lot of information on what ImDisk does differently than aim_ll.exe.
EDIT: Recently I wanted to see if I could find a way to make a health check/Nagios alert for checking if the ram disk was missing the flag mentioned in the github comment. I used fsutil fsInfo volumeInfo <drive name> to get the volume info for each drive and noticed the following difference.
Mounted with aim_ll

PS C:\scripts> fsutil fsInfo volumeInfo D:
Volume Name :
Volume Serial Number : 0x147ac565
Max Component Length : 255
File System Name : NTFS
Is ReadWrite
Not Thinly-Provisioned
Supports Case-sensitive filenames
Preserves Case of filenames
Supports Unicode in filenames
Preserves & Enforces ACL's
Supports file-based Compression
Supports Disk Quotas
Supports Sparse files
Supports Reparse Points
Returns Handle Close Result Information
Supports POSIX-style Unlink and Rename
Supports Object Identifiers
Supports Encrypted File System
Supports Named Streams
Supports Transactions
Supports Hard Links
Supports Extended Attributes
Supports Open By FileID
Supports USN Journal

Mounted with imdisk

PS C:\scripts> fsutil fsInfo volumeInfo E:
Volume Name :
Volume Serial Number : 0xe82847c7
Max Component Length : 255
File System Name : NTFS
Is ReadWrite
Error:  Incorrect function.
Supports Case-sensitive filenames
Preserves Case of filenames
Supports Unicode in filenames
Preserves & Enforces ACL's
Supports file-based Compression
Supports Disk Quotas
Supports Sparse files
Supports Reparse Points
Returns Handle Close Result Information
Supports POSIX-style Unlink and Rename
Supports Object Identifiers
Supports Encrypted File System
Supports Named Streams
Supports Transactions
Supports Hard Links
Supports Extended Attributes
Supports Open By FileID
Supports USN Journal

This line appears in the disk made by imdisk Error: Incorrect function. I am not sure why this was left out when making the drive, but if you are looking for a way to detect if the drive will work for various tools, then this seems to be the important difference to test for.

dba5bblo

dba5bblo2#

创建构建脚本,如果您构建了ionic,则运行这些命令,同时登录到构建服务器并在相同位置手动构建

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

相关问题