npm ci with nx version 2 build | ERROR: "Expected:[ 1 ] Found: [ 2 ]"

204 views Asked by At

When I use npm ci --cache .npm --prefer-offline --no-audit --ignore-scripts everything is ok. But if I use ng build after this I will catch error

Invalid format version detected - Expected:[ 1 ] Found: [ 2 ]
npm ERR! code ELIFECYCLE
npm ERR! errno 1        
npm ERR! [email protected] build:ssr: `ng build && ng run gofast-app:server --verbose`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build:ssr script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I used project.json files. If I change version of angular.json from 2 to 1 I won't be able to use string path to project.json and will catch this error

Skipping invalid project value; expected an object.
Skipping invalid project value; expected an object.
Skipping invalid project value; expected an object.
Skipping invalid project value; expected an object.
// . . .
// It repeats as many times as many projects I have
// . . .
Skipping invalid project value; expected an object.

Cannot determine project or target for command.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:ssr: `ng build && ng run gofast-app:server --verbose`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:ssr script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.



angular.json

{
  "version": 2,
  "cli": {
    "cache": {
      "enabled": false
    }
  },
  "projects": {
    "auth": "libs/auth",
    "gpfast-app": "apps/gofast-app",
    "auth-app": "apps/auth-app",
    "auth-app-e2e": "apps/auth-app-e2e",
    "core-analytics-service": "libs/core/analytics-service",
    "core-backend-services": "libs/core/backend-services",
    "core-cookie-service": "libs/core/cookie-service",
    "core-currency-service": "libs/core/currency-service",
    "core-custom-trans-loader": "libs/core/custom-trans-loader",
    "core-environment-service": "libs/core/environment-service",
    "core-games-service": "libs/core/games-service",
    "core-guards": "libs/core/guards",
    "core-iframe": "libs/core/iframe",
    "core-language-service": "libs/core/language-service",
    "core-layout-service": "libs/core/layout-service",
    "core-license-service": "libs/core/license-service",
    "core-local-storage-service": "libs/core/local-storage-service",
    "core-modal-service": "libs/core/modal-service",
    "core-navigation-common": "libs/core/navigation/common",
    "core-notification-service": "libs/core/notification-service",
    "core-portal-service": "libs/core/portal-service",
    "core-router-service": "libs/core/router-service",
    "core-scroll-service": "libs/core/scroll-service",
    "core-seo-service": "libs/core/seo-service",
    "core-socket-io": "libs/core/socket-io",
    "core-sound-service": "libs/core/sound-service",
    "core-state-account": "libs/core/state/account",
    "core-state-chat": "libs/core/state/chat",
    "core-state-common": "libs/core/state/common",
    "core-state-currency-store": "libs/core/state/currency-store",
    "core-state-games-store": "libs/core/state/games-store",
    "core-state-inventory": "libs/core/state/inventory",
    "core-state-layout": "libs/core/state/layout",
    "core-state-lottery": "libs/core/state/lottery",
    "core-state-modals": "libs/core/state/modals",
    "core-state-notifications": "libs/core/state/notifications",
    "core-state-payment-store": "libs/core/state/payment-store",
    "core-state-referrals": "libs/core/state/referrals",
    "core-state-user-store": "libs/core/state/user-store",
    "core-state-utils": "libs/core/state/utils",
    "core-types": "libs/core/types",
    "desktop-app-header": "libs/desktop-app/header",
    "desktop-app-left-sidebar": "libs/desktop-app/left-sidebar",
    "desktop-app-right-sidebar": "libs/desktop-app/right-sidebar",
    "games": "libs/games",
    "gofast-app": "apps/gofast-app",
    "gofast-app-e2e": "apps/gofast-app-e2e",
    "gofast-layout": "libs/gofast/layout",
    "mobile-app-header": "libs/mobile-app/header",
    "modules-account-home": "libs/modules/account/home",
    "modules-account-service": "libs/modules/account/service",
    "modules-aml-policy": "libs/modules/aml-policy",
    "modules-anti-bribery-policy": "libs/modules/anti-bribery-policy",
    "modules-balance-home": "libs/modules/balance/home",
    "modules-balance-service": "libs/modules/balance/service",
    "modules-balance-state": "libs/modules/balance/state",
    "modules-bonuses": "libs/modules/bonuses",
    "modules-bug-bounty": "libs/modules/bug-bounty",
    "modules-events": "libs/modules/events",
    "modules-faq-components": "libs/modules/faq/components",
    "modules-faq-home": "libs/modules/faq/home",
    "modules-faq-service": "libs/modules/faq/service",
    "modules-faq-state": "libs/modules/faq/state",
    "modules-p2p": "libs/modules/p2p",
    "modules-privacy-policy": "libs/modules/privacy-policy",
    "modules-refund-policy": "libs/modules/refund-policy",
    "modules-support-home": "libs/modules/support/home",
    "modules-support-service": "libs/modules/support/service",
    "modules-tos": "libs/modules/tos",
    "not-found-page": "libs/not-found-page",
    "notifications": "libs/notifications",
    "shared-assets": "libs/shared/assets",
    "shared-components": "libs/shared/components",
    "shared-directives": "libs/shared/directives",
    "shared-modals": "libs/shared/modals",
    "shared-modules": "libs/shared/modules",
    "shared-pipes": "libs/shared/pipes",
    "shared-utils": "libs/shared/utils",
    "ui-components": "libs/ui/components",
    "ui-grid": "libs/ui/grid",
    "ui-icons": "libs/ui/icons",
    "widgets-active-prize-raffling": "libs/widgets/active-prize-raffling",
    "widgets-chat": "libs/widgets/chat",
    "widgets-notifications": "libs/widgets/notifications",
    "widgets-p2p": "libs/widgets/p2p",
    "widgets-recent-activities": "libs/widgets/recent-activities"
  }
}

apps/gofast-app/project.json

{
  "name": "gofast-app",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "projectType": "application",
  "sourceRoot": "apps/gofast-app/src",
  "prefix": "csgofast",
  "targets": {
    "build": {
      "executor": "@angular-devkit/build-angular:browser",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/apps/gofast-app/browser",
        "index": "apps/gofast-app/src/index.html",
        "main": "apps/gofast-app/src/main.ts",
        "polyfills": "apps/gofast-app/src/polyfills.ts",
        "tsConfig": "apps/gofast-app/tsconfig.app.json",
        "inlineStyleLanguage": "scss",
        "assets": [
          {
            "glob": "**/*",
            "input": "apps/gofast-app/src/root/",
            "output": "/"
          },
          "apps/gofast-app/src/favicon.ico",
          "apps/gofast-app/src/assets",
          {
            "glob": "**/*",
            "input": "./libs/shared/assets/src/",
            "output": "./assets"
          }
        ],
        "allowedCommonJsDependencies": ["socket.io-client", "is-ua-webview", "howler", "moment-timezone", "moment", "bezier-easing"],
        "stylePreprocessorOptions": {
          "includePaths": [
            "libs/shared/assets/src"
          ]
        },
        "styles": ["apps/gofast-app/src/styles.scss"],
        "scripts": []
      },
      "configurations": {
        "production": {
          "sourceMap": {
            "hidden": true,
            "scripts": true,
            "styles": true
          },
          "index": {
            "input": "apps/gofast-app/src/index.prod.html",
            "output": "index.html"
          },
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "5mb",
              "maximumError": "10mb"
            },
            {
              "type": "anyComponentStyle",
              "maximumWarning": "20kb",
              "maximumError": "40kb"
            }
          ],
          "fileReplacements": [
            {
              "replace": "apps/gofast-app/src/environments/environment.ts",
              "with": "apps/gofast-app/src/environments/environment.prod.ts"
            }
          ],
          "outputHashing": "all"
        },
        "development": {
          "buildOptimizer": false,
          "optimization": false,
          "vendorChunk": true,
          "extractLicenses": false,
          "sourceMap": true,
          "namedChunks": true,
          "fileReplacements": [
            {
              "replace": "apps/gofast-app/src/environments/environment.ts",
              "with": "apps/gofast-app/src/environments/environment.dev.ts"
            }
          ]
        },
        "stage": {
          "buildOptimizer": false,
          "optimization": false,
          "vendorChunk": true,
          "extractLicenses": false,
          "namedChunks": true,
          "sourceMap": {
            "hidden": true,
            "scripts": true,
            "styles": true
          },
          "index": {
            "input": "apps/gofast-app/src/index.stage.html",
            "output": "index.html"
          },
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "5mb",
              "maximumError": "10mb"
            },
            {
              "type": "anyComponentStyle",
              "maximumWarning": "20kb",
              "maximumError": "40kb"
            }
          ],
          "fileReplacements": [
            {
              "replace": "apps/gofast-app/src/environments/environment.ts",
              "with": "apps/gofast-app/src/environments/environment.stage.ts"
            }
          ],
          "outputHashing": "all"
        },
        "prodEU": {
          "sourceMap": {
            "hidden": true,
            "scripts": true,
            "styles": true
          },
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "5mb",
              "maximumError": "10mb"
            },
            {
              "type": "anyComponentStyle",
              "maximumWarning": "20kb",
              "maximumError": "40kb"
            }
          ],
          "index": {
            "input": "apps/gofast-app/src/index.eu.html",
            "output": "index.html"
          },
          "fileReplacements": [
            {
              "replace": "apps/gofast-app/src/environments/environment.ts",
              "with": "apps/gofast-app/src/environments/environment.eu.ts"
            }
          ],
          "outputHashing": "all"
        }
      },
      "defaultConfiguration": "production"
    },
    "serve": {
      "executor": "@angular-devkit/build-angular:dev-server",
      "configurations": {
        "production": {
          "browserTarget": "gofast-app:build:production"
        },
        "development": {
          "browserTarget": "gofast-app:build:development"
        },
        "stage": {
          "browserTarget": "gofast-app:build:stage"
        }
      },
      "defaultConfiguration": "development"
    },
    "extract-i18n": {
      "executor": "@angular-devkit/build-angular:extract-i18n",
      "options": {
        "browserTarget": "gofast-app:build"
      }
    },
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "options": {
        "lintFilePatterns": ["apps/gofast-app/src/**/*.ts", "apps/gofast-app/src/**/*.html"]
      }
    },
    "test": {
      "executor": "@nrwl/jest:jest",
      "outputs": ["{workspaceRoot}/coverage/apps/gofast-app"],
      "options": {
        "jestConfig": "apps/gofast-app/jest.config.ts",
        "passWithNoTests": true
      }
    },
    "server": {
      "dependsOn": ["build"],
      "executor": "@angular-devkit/build-angular:server",
      "options": {
        "outputPath": "dist/apps/gofast-app/server",
        "main": "apps/gofast-app/server.ts",
        "tsConfig": "apps/gofast-app/tsconfig.server.json",
        "stylePreprocessorOptions": {
          "includePaths": [
            "libs/shared/assets/src"
          ]
        },
        "inlineStyleLanguage": "scss"
      },
      "configurations": {
        "production": {
          "outputHashing": "media",
          "fileReplacements": [
            {
              "replace": "apps/gofast-app/src/environments/environment.ts",
              "with": "apps/gofast-app/src/environments/environment.ssr.ts"
            }
          ],
          "sourceMap": {
            "hidden": true,
            "scripts": true,
            "styles": true
          }
        },
        "development": {
          "fileReplacements": [
            {
              "replace": "apps/gofast-app/src/environments/environment.ts",
              "with": "apps/gofast-app/src/environments/environment.dev.ts"
            }
          ],
          "optimization": false,
          "sourceMap": true,
          "extractLicenses": false,
          "vendorChunk": true
        },
        "prodEU": {
          "outputHashing": "media",
          "fileReplacements": [
            {
              "replace": "apps/gofast-app/src/environments/environment.ts",
              "with": "apps/gofast-app/src/environments/environment.eu.ts"
            }
          ],
          "sourceMap": {
            "hidden": true,
            "scripts": true,
            "styles": true
          }
        },
        "stage": {
          "outputHashing": "media",
          "fileReplacements": [
            {
              "replace": "apps/gofast-app/src/environments/environment.ts",
              "with": "apps/gofast-app/src/environments/environment.stage.ts"
            }
          ],
          "sourceMap": {
            "hidden": true,
            "scripts": true,
            "styles": true
          }
        }
      },
      "defaultConfiguration": "production"
    },
    "serve-ssr": {
      "executor": "@nguniversal/builders:ssr-dev-server",
      "configurations": {
        "development": {
          "browserTarget": "gofast-app:build:development",
          "serverTarget": "gofast-app:server:development"
        },
        "production": {
          "browserTarget": "gofast-app:build:production",
          "serverTarget": "gofast-app:server:production"
        },
        "stage": {
          "browserTarget": "gofast-app:build:stage",
          "serverTarget": "gofast-app:server:stage"
        }
      },
      "defaultConfiguration": "development"
    },
    "prerender": {
      "executor": "@nguniversal/builders:prerender",
      "options": {
        "routesFile": "./routes.txt"
      },
      "configurations": {
        "production": {
          "browserTarget": "gofast-app:build:production",
          "serverTarget": "gofast-app:server:production"
        },
        "development": {
          "browserTarget": "gofast-app:build:development",
          "serverTarget": "gofast-app:server:development"
        },
        "stage": {
          "browserTarget": "gofast-app:build:stage",
          "serverTarget": "gofast-app:server:stage"
        }
      },
      "defaultConfiguration": "production"
    },
    "prerenderskins": {
      "executor": "@nguniversal/builders:prerender",
      "options": {
        "routesFile": "./routes-skins.txt",
        "serverTarget": "gofast-app:server:production"
      },
      "configurations": {
        "production": {
          "browserTarget": "gofast-app:build:production",
          "serverTarget": "gofast-app:server:production"
        },
        "development": {
          "browserTarget": "gofast-app:build:development",
          "serverTarget": "gofast-app:server:development"
        },
        "stage": {
          "browserTarget": "gofast-app:build:stage",
          "serverTarget": "gofast-app:server:stage"
        }
      },
      "defaultConfiguration": "production"
    }
  },
  "tags": ["scope:app"]
}
0

There are 0 answers