Nx invalid symbol in nx.json

21 views Asked by At

I recently installed and migrated my project to nx monorepo. Everything worked fine, after updateing project from git (no changes in this angular project) I cannot serve, build or even "npm i" due to this error:

npm ERR! code 1
npm ERR! path D:\Angular\node_modules\nx
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./bin/post-install
npm ERR! D:\Angular\node_modules\nx\src\utils\fileutils.js:26
npm ERR!         throw e;
npm ERR!         ^
npm ERR!
npm ERR! Error: InvalidSymbol in D:\Angular\nx.json at 1:1
npm ERR! > 1 | {
npm ERR!     | ^
npm ERR!   2 |   "defaultBase": "master",
npm ERR!   3 |   "namedInputs": {
npm ERR!   4 |     "sharedGlobals": [],
npm ERR!
npm ERR!     at parseJson (D:\Angular\node_modules\nx\src\utils\json.js:27:15)
npm ERR!     at readJsonFile (D:\Angular\node_modules\nx\src\utils\fileutils.js:22:37)
npm ERR!     at readNxJson (D:\Angular\node_modules\nx\src\config\nx-json.js:11:66)
npm ERR!     at Object.<anonymous> (D:\Angular\node_modules\nx\src\daemon\client\client.js:322:72)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1241:14)
npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1091:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:938:12)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1115:19)
npm ERR!     at require (node:internal/modules/helpers:130:18)
npm ERR!
npm ERR! Node.js v20.9.0

My nx.json seems fine, i've checked for invisible characters.

{
  "defaultBase": "master",
  "namedInputs": {
    "sharedGlobals": [],
    "default": ["{projectRoot}/**/*", "sharedGlobals"],
    "production": [
      "default",
      "!{projectRoot}/tsconfig.spec.json",
      "!{projectRoot}/**/*.spec.[jt]s",
      "!{projectRoot}/karma.conf.js",
      "!{projectRoot}/.eslintrc.json",
      "!{projectRoot}/eslint.config.js"
    ]
  },
  "targetDefaults": {
    "build": {
      "dependsOn": ["^build"],
      "inputs": ["production", "^production"],
      "cache": true
    },
    "test": {
      "inputs": ["default", "^production", "{workspaceRoot}/karma.conf.js"],
      "cache": true
    },
    "lint": {
      "inputs": [
        "default",
        "{workspaceRoot}/.eslintrc.json",
        "{workspaceRoot}/eslint.config.js"
      ],
      "cache": true
    },
    "@nx/eslint:lint": {
      "cache": true,
      "inputs": [
        "default",
        "{workspaceRoot}/.eslintrc.json",
        "{workspaceRoot}/.eslintignore",
        "{workspaceRoot}/eslint.config.js"
      ]
    }
  },
  "plugins": [
    {
      "plugin": "@nx/eslint/plugin",
      "options": {
        "targetName": "lint"
      }
    }
  ]
}

I thought it might be cache or node modules issues, so i deleted nx cache, node_modules and package-lock.json to reinstall modules, but when i wanted to npm install i got the same error like before when trying to build.

0

There are 0 answers