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

validateString behavior change? #46653

Closed
xylo04 opened this issue Feb 14, 2023 · 4 comments
Closed

validateString behavior change? #46653

xylo04 opened this issue Feb 14, 2023 · 4 comments

Comments

@xylo04
Copy link

xylo04 commented Feb 14, 2023

Version

v18.14.0

Platform

Linux [redacted] 6.0.12-76060006-generic #202212290932167413972522.04~ca93ccf SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

At k0swe/forester@82cb2c9 with npm 9.3.1 and node 18.14.0, attempt to run npm update.

How often does it reproduce? Is there a required condition?

Constant

What is the expected behavior?

npm update completes without error

What do you see instead?

...
6387 timing reifyNode:node_modules/google-gax/node_modules/@grpc/grpc-js Completed in 412ms
6388 timing reifyNode:node_modules/jose Completed in 417ms
6389 timing reifyNode:node_modules/google-gax Completed in 445ms
6390 timing reifyNode:node_modules/caniuse-lite Completed in 455ms
6391 timing reify:unpack Completed in 462ms
6392 timing command:update Completed in 34524ms
6393 verbose stack TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined
6393 verbose stack     at new NodeError (node:internal/errors:399:5)
6393 verbose stack     at validateString (node:internal/validators:163:11)
6393 verbose stack     at relative (node:path:1191:5)
6393 verbose stack     at /home/chris/.nvm/versions/node/v18.14.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1093:21
6393 verbose stack     at Array.map (<anonymous>)
6393 verbose stack     at /home/chris/.nvm/versions/node/v18.14.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1091:66
6393 verbose stack     at Array.map (<anonymous>)
6393 verbose stack     at [rollbackMoveBackRetiredUnchanged] (/home/chris/.nvm/versions/node/v18.14.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1091:8)
6393 verbose stack     at [reifyPackages] (/home/chris/.nvm/versions/node/v18.14.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:239:31)
6393 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
6394 verbose cwd /home/chris/src/k0swe/forester
6395 verbose Linux 6.0.12-76060006-generic
6396 verbose node v18.14.0
6397 verbose npm  v9.3.1
6398 error code ERR_INVALID_ARG_TYPE
6399 error The "from" argument must be of type string. Received undefined
6400 verbose exit 1
6401 timing npm Completed in 34551ms
6402 verbose unfinished npm timer reify 1676390457583
6403 verbose unfinished npm timer reify:audit 1676390491621
6404 verbose unfinished npm timer auditReport:getReport 1676390491621
6405 verbose unfinished npm timer reify:unretire 1676390492102
6406 verbose code 1
6407 error A complete log of this run can be found in:
6407 error     /home/chris/.npm/_logs/2023-02-14T16_00_57_558Z-debug-0.log

Additional information

More information in k0swe/forester#1698. I'm speculating from the stack trace that node:internal/validators validateString used to accept undefined and simply return false instead of throwing an error. Or perhaps node:path relative is now calling that with undefined when it should not.

@debadree25
Copy link
Member

The git blame on validateString still shows last change from 5 years back so probably the second hypothesis?

@bnoordhuis
Copy link
Member

That check in path.relative() isn't new either, not by a long shot. This is with near certainty a problem with your setup, not with node.

If you have reason to believe otherwise, please elaborate, but otherwise I suggest you close this.

@xylo04
Copy link
Author

xylo04 commented Feb 14, 2023

I believe you that it's something with my setup, but it's also reproducible on a brand new github codespace, so it's not just a "works on my machine" issue. Maybe there's some interaction with my particular dependencies.

I'll try some different combinations of node and let you know the results.

@xylo04
Copy link
Author

xylo04 commented Feb 14, 2023

Aha, I think I'm experiencing npm/cli#4907. Sounds like as a workaround I can delete and regenerate package-lock.json, must be some poor interaction between deps. Thanks for your time!

@xylo04 xylo04 closed this as completed Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants