npm / npm/cli

[BUG] TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string.

Open
#4,907 25 comments 23 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 8.x
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

On the local machine packages and workspaces are installed properly.

When using gitlab CI, this error occur:

npm timing reifyNode:node_modules/react-native Completed in 224225ms
npm timing reify:unpack Completed in 224435ms
npm timing command:i Completed in 247734ms
npm verb stack TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined
npm verb stack     at new NodeError (node:internal/errors:372:5)
npm verb stack     at validateString (node:internal/validators:120:11)
npm verb stack     at relative (node:path:1191:5)
npm verb stack     at /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1073:21
npm verb stack     at Array.map (<anonymous>)
npm verb stack     at /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1071:66
npm verb stack     at Array.map (<anonymous>)
npm verb stack     at Arborist.[rollbackMoveBackRetiredUnchanged] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1071:8)
npm verb stack     at Arborist.[reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:235:31)
npm verb stack     at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:155:5)
npm verb cwd /builds/millionpugs/web-frontend
npm verb Linux 5.4.109+
npm verb node v16.15.0
npm verb npm  v8.10.0
npm ERR! code ERR_INVALID_ARG_TYPE
npm ERR! The "from" argument must be of type string. Received undefined
npm verb exit 1
npm timing npm Completed in 247884ms
Expected Behavior

It should install without errors or create debug log that helps to find a solution.

Steps To Reproduce

Just run npm i

Environment
  • npm: 8.10.0
  • Node.js: 14.17.4 or 16.15.0
  • OS Name: macOS / GITLAB CI
  • System Model Name: macOs Monterey
  • npm config:
; node bin location = /Users/wjureczka/.nvm/versions/node/16.15.0/bin/node
; node version = v16.15.0
; npm local prefix = /Users/wjureczka/Projects/
; npm version = 8.10.0
; cwd = /Users/wjureczka/Projects/
; HOME = /Users/wjureczka

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 with @npmcli/arborist/lib/arborist/reify.js around rollbackMoveBackRetiredUnchanged, using the reported npm i failure and stack trace as the entry point. Reproduce with npm 8.10.0 on the listed Node versions in GitLab CI, then compare the local and CI environments. Done means installation succeeds or the diagnostic output identifies the missing path value and its cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.