npm / npm/cli

[BUG] npm install throws "ERR_INVALID_ARG_TYPE" if empty yarn.lock folder is present in root directory.

Open
#8,782 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

npm install

npm error code ERR_INVALID_ARG_TYPE
npm error The "path" argument must be of type string or an instance of Buffer or URL. Received null
npm error A complete log of this run can be found in: /Users/nparoski/.npm/_logs/2025-11-26T10_05_44_942Z-debug-0.log
Expected Behavior

Expected to install packages without issues.

Steps To Reproduce
  1. npm init
  2. npm install <package name>
  3. mkdir yarn.lock
  4. npm install
Environment
  • npm: 10.9.0
  • Node.js: 22.10.0
  • OS Name: MacOS / Ubuntu
  • System Model Name: macOS Sequoia / Ubuntu 22
  • npm config:
; node bin location = /Users/nparoski/.nvm/versions/node/v22.10.0/bin/node
; node version = v22.10.0
; npm local prefix = /Users/nparoski/projects/npm-test
; npm version = 10.9.0
; cwd = /Users/nparoski/projects/npm-test
; HOME = /Users/nparoski
; Run `npm config ls -l` to show all defaults.```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported sequence with npm init, npm install, an empty yarn.lock directory, and npm install again. Trace how npm install handles the root yarn.lock path, then verify that installation succeeds and add regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.