Nicole Phillips
Nicole Phillips

Reputation: 763

Getting MissingPackageName: Invalid or missing package.json file at '' when trying to install node modules

My team and I are in the middle of upgrading our Salesforce DX plugin to SF version 2. While applying changes to the package.json and tsconfig we are getting this error message:

"MissingPackageName: Invalid or missing package.json file at ''"

We are all able to reproduce the problem on our own personal computers so it is definitely not a case of not changing the directory.

The package.json

{
  "name": "delphi",
  "description": "A plugin for Delphi build/deploy tools",
  "version": "1.0.0",
  "dependencies": {
    "@oclif/core": "^4",
    "@salesforce/core": "^8.1.1",
    "@salesforce/kit": "^3.0.15",
    "@salesforce/sf-plugins-core": "^11.1.6",
    "@types/fs-extra": "^11.0.1",
    "@types/jenkins": "^0.23.3",
    "@types/jsforce": "^1.11.1",
    "@typescript-eslint/eslint-plugin": "^6.6.0",
    "@typescript-eslint/parser": "^6",
    "azure-devops-node-api": "^12.1.0",
    "azure-pipelines-task-lib": "^4.5.0",
    "chai-as-promised": "^7.1.1",
    "chalk": "4.1.2",
    "cli-progress": "^3.12.0",
    "colors": "^1.4.0",
    "cpx2": "^5.0.0",
    "deep-equal-in-any-order": "^2.0.6",
    "delphi": "^0.0.2",
    "eslint": "^8",
    "eslint-config-prettier": "^9",
    "eslint-plugin-header": "^3",
    "eslint-plugin-import": "^2",
    "eslint-plugin-jsdoc": "^46",
    "eslint-plugin-prettier": "^5",
    "fs-extra": "^11.1.1",
    "jenkins": "^0.28.1",
    "jsforce": "^1.11.1",
    "mem-fs": "^3.0.0",
    "mem-fs-editor": "^10.0.2",
    "oclif": "^4.0.4",
    "prettier": "^3",
    "ramda": "^0.29.0",
    "rimraf": "^5.0.1",
    "sinon": "^15.2.0",
    "tslib": "^2.6.2",
    "tty-table": "^4.2.3",
    "typed-rest-client": "^1.8.11",
    "unzip": "^0.1.11",
    "unzipper": "^0.10.14"
  },
  "devDependencies": {
    "@oclif/plugin-command-snapshot": "^5.1.9",
    "@oclif/test": "^2.5.4",
    "@salesforce/cli-plugins-testkit": "^5.3.10",
    "@salesforce/dev-config": "^4.0.1",
    "@salesforce/dev-scripts": "^10",
    "@salesforce/prettier-config": "^0.0.3",
    "@salesforce/ts-sinon": "1.4.15",
    "@swc/core": "^1.3.83",
    "@types/chai": "4.3.6",
    "@types/chai-as-promised": "^7.1.6",
    "@types/fs-extra": "^11.0.1",
    "@types/mocha": "^10.0.1",
    "@types/node": "^20.9.0",
    "chai": "^4.3.8",
    "eslint-config-salesforce": "^2.0.2",
    "eslint-config-salesforce-license": "^0.2.0",
    "eslint-config-salesforce-typescript": "^1.1.2",
    "eslint-plugin-sf-plugin": "^1.18.6",
    "globby": "^13",
    "husky": "^8.0.3",
    "mocha": "^10.2.0",
    "nyc": "^15.1.0",
    "oclif": "^4.8.1",
    "pretty-quick": "^4.0.0",
    "rimraf": "^5.0.1",
    "shx": "0.3.4",
    "sinon": "^15.2.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.4.5",
    "wireit": "^0.10.0"
  },
  "engines": {
    "node": ">=20.9.0"
  },
  "exports": "./lib/index.js",
  "type": "module",
  "files": [
    "/lib",
    "/messages",
    "/oclif.manifest.json"
  ],
  "keywords": [
    "force",
    "salesforce",
    "sfdx",
    "salesforcedx",
    "sfdx-plugin",
    "sf-plugin",
    "sf"
  ],
  "license": "BSD-3-Clause",
  "main": "lib/index.js",
  "oclif": {
    "commands": "./lib/commands",
    "bin": "sf",
    "topicSeparator": " ",
    "devPlugins": [
      "@oclif/plugin-help"
    ],
    "topics": {
      "delphi": {
        "description": "description for delphi",
        "subtopics": {
          "scan": {
            "description": "description for delphi.scan"
          }
        }
      }
    }
  },
  "scripts": {
    "build": "wireit",
    "clean": "sf-clean",
    "clean-all": "sf-clean all",
    "clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
    "compile": "wireit",
    "docs": "sf-docs",
    "format": "wireit",
    "postpack": "sf-clean --ignore-signing-artifacts",
    "prepare": "shx rm -rf lib && tsc -b && oclif manifest",
    "prepack": "sf-prepack",
    "test": "wireit",
    "test:only": "wireit",
    "version": "oclif readme"
  },
  "overrides": {
    "graceful-fs": "^4.2.4",
    "jsforce": {
      "request": {
        "uuid": "^7"
      }
    },
    "azure-pipelines-task-lib": {
      "uuid": "^7"
    },
    "@salesforce/dev-scripts": {
      "typedoc": "^0.25.1",
      "typedoc-plugin-missing-exports": "^2.1.0"
    }
  },
  "publishConfig": {
    "access": "public"
  },
  "wireit": {
    "build": {
      "dependencies": [
        "compile"
      ]
    },
    "compile": {
      "command": "tsc -p . --pretty --incremental",
      "files": [
        "src/**/*.ts",
        "**/tsconfig.json",
        "messages/**"
      ],
      "output": [
        "lib/**",
        "*.tsbuildinfo"
      ],
      "clean": "if-file-deleted"
    },
    "format": {
      "command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"",
      "files": [
        "src/**/*.ts",
        "test/**/*.ts",
        "schemas/**/*.json",
        "command-snapshot.json",
        ".prettier*"
      ],
      "output": []
    },
    "test:compile": {
      "command": "tsc -p \"./test\" --pretty",
      "files": [
        "test/**/*.ts",
        "**/tsconfig.json"
      ],
      "output": []
    },
    "test": {
      "dependencies": [
        "test:compile",
        "test:only"
      ]
    },
    "test:only": {
      "command": "nyc mocha \"test/**/*.test.ts\"",
      "env": {
        "FORCE_COLOR": "2"
      },
      "files": [
        "test/**/*.ts",
        "src/**/*.ts",
        "**/tsconfig.json",
        ".mocha*",
        "!*.nut.ts",
        ".nycrc"
      ],
      "output": []
    },
    "test:command-reference": {
      "command": "\"./bin/dev\" commandreference:generate --erroronwarnings",
      "files": [
        "src/**/*.ts",
        "messages/**",
        "package.json"
      ],
      "output": [
        "tmp/root"
      ]
    },
    "test:deprecation-policy": {
      "command": "\"./bin/dev\" snapshot:compare",
      "files": [
        "src/**/*.ts"
      ],
      "output": [],
      "dependencies": [
        "compile"
      ]
    },
    "test:json-schema": {
      "command": "\"./bin/dev\" schema:compare",
      "files": [
        "src/**/*.ts",
        "schemas"
      ],
      "output": []
    }
  },
  "author": "Team DNA"
}

The tsconfig:

{
  "extends": "./node_modules/@salesforce/dev-config/tsconfig-strict-esm",
  "compilerOptions": {
    "declaration": false,
    "target": "ESNext",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "outDir": "./lib",
    "rootDir": "./src",
    "importHelpers": true,
    "allowJs": true,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "noUnusedLocals": false,
    "skipLibCheck": true,
    "strict": false //To be removed later on, this is added just for testing to not show errors related to 'any'
  },
  "ts-node": {
    "esm": true
  },
  "include": [
    "./src/**/*.ts"
  ]
}

Any help or suggestions we be great!

I've tried deleting the node modules folder and that does nothing. So far I cannot find any resolution to the problem on the internet and I'm lost.

Upvotes: 0

Views: 38

Answers (0)

Related Questions