Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace with auto-install-peers throwing unhandled error (Cannot convert undefined or null to object) #4796

Closed
dapuicon opened this issue May 25, 2022 · 7 comments · Fixed by #4807
Assignees

Comments

@dapuicon
Copy link

pnpm version: 7.1.5

Code to reproduce the issue:

git clone https://github.com/dapuicon/pnpm-workspace-error.git
pnpm i

.pnpm-debug.log

{
  "0 debug pnpm:scope": {
    "selected": 2,
    "total": 2,
    "workspacePrefix": "C:\\Users\\user\\Desktop\\pnpm-workspace-error"
  },
  "1 debug pnpm:package-manifest": {
    "initial": {
      "name": "core",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "dependencies": {
        "eslint-config-react-app": "^7.0.1"
      },
      "keywords": [],
      "author": "",
      "license": "ISC"
    },
    "prefix": "C:\\Users\\user\\Desktop\\pnpm-workspace-error\\packages\\core"
  },
  "2 debug pnpm:package-manifest": {
    "initial": {
      "name": "container",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "dependencies": {
        "core": "workspace: *"
      },
      "keywords": [],
      "author": "",
      "license": "ISC"
    },
    "prefix": "C:\\Users\\user\\Desktop\\pnpm-workspace-error\\apps\\container"
  },
  "3 debug pnpm:context": {
    "currentLockfileExists": false,
    "storeDir": "C:\\Users\\user\\AppData\\Local\\pnpm\\store\\v3",
    "virtualStoreDir": "C:\\Users\\user\\Desktop\\pnpm-workspace-error\\node_modules\\.pnpm"
  },
  "4 debug pnpm:stage": {
    "prefix": "C:\\Users\\user\\Desktop\\pnpm-workspace-error",
    "stage": "resolution_started"
  },
  "5 debug pnpm:_dependency_resolved": {
    "resolution": "link:../../packages/core",
    "wanted": {
      "dependentId": "apps/container",
      "name": "core",
      "rawSpec": "workspace: *"
    }
  },
  "6 error pnpm": {
    "err": {
      "name": "pnpm",
      "message": "Cannot convert undefined or null to object",
      "stack": "pnpm: Cannot convert undefined or null to object\n    at Function.entries (<anonymous>)\n    at mergePkgsDeps (C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:116171:44)\n    at resolveDependencies (C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:116144:33)\n    at async C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:116691:47\n    at async Promise.all (index 1)\n    at async default_1 (C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:116661:7)\n    at async default_1 (C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:117814:133)\n    at async _installInContext (C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:120367:238)\n    at async installInContext (C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:120631:16)\n    at async _install (C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\pnpm\\dist\\pnpm.cjs:120232:25)"
    }
  }
}

Expected behavior:

Install all dependencies, including peerDependencies and link local packages.

Actual behavior: Unhandled error

Additional information:

Setting auto-install-peers=false in .npmrc makes process work.

  • node -v prints: v16.15.0
  • Windows
@gunta
Copy link

gunta commented May 25, 2022

Reproduced here with 7.1.5 for first time. It was working with 7.1.0.

pnpm i 
Scope: all 9 workspace projects
 ERROR  Cannot convert undefined or null to object
Progress: resolved 56, reused 25, downloaded 1, added 0
Downloading registry.npmjs.org/typescript/4.7.2: 966 kB/11.7 MB

@darkskygit
Copy link

same problem, the first version that had the problem was 7.1.3

@AdrielLimanthie
Copy link

The same issue also happens to me on version 6.32.16 to 6.32.17. So, it was most likely caused by this PR #4776

Downgrading the pnpm version to 6.32.15, I was able to run it without encountering the error

@laozhu
Copy link

laozhu commented May 26, 2022

The same problem here, monorepo with pnpm install

# .npmrc
auto-install-peers=true
enable-pre-post-scripts=true
git-checks=false
shamefully-hoist=true
pnpm version
7.1.2

@slowdownitsfine
Copy link

slowdownitsfine commented May 26, 2022

same problem here, 7.1.5.

setting auto-install-peers=false in .npmrc helps avoid it for now.

@zkochan
Copy link
Member

zkochan commented May 27, 2022

🚢 7.1.6

@dapuicon
Copy link
Author

@zkochan, tested in 7.1.6 and working. Great job !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants