Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

fix: support system root path with no pkg name #189

Merged
merged 2 commits into from
Dec 1, 2020

Conversation

ruyadorno
Copy link
Contributor

Right now if your cwd is / npm exec, npm ls (or any arborist-dependent
command) will fail with a "could not detect node name from path or
package" error.

This patches add a manual "system-root" name to allow arborist to build
a tree from /

lib/node.js Outdated Show resolved Hide resolved
@darcyclarke
Copy link
Contributor

darcyclarke commented Nov 27, 2020

Considerations

  • where can/does this break today?
  • can we fix the references/checks to this.name without falling back or using this placeholder?
  • can we use an invalid or scoped package name to ensure there aren't collisions?

@ruyadorno
Copy link
Contributor Author

relates to: npm/cli#1975 (comment)

isaacs and others added 2 commits December 1, 2020 12:19
Right now if your cwd is / npm exec, npm ls (or any arborist-dependent
command) will fail with a "could not detect node name from path or
package" error.

This patches add a manual "system-root" name to allow arborist to build
a tree from /

PR-URL: #189
Credit: @ruyadorno
Close: #189
Reviewed-by: @isaacs
@isaacs isaacs force-pushed the fix-run-from-system-root branch from 5190d50 to bf04701 Compare December 1, 2020 22:06
@isaacs
Copy link
Contributor

isaacs commented Dec 1, 2020

Trying a different approach: just let it be nameless if it's in the system root path. It should be fine, since we never use system root nodes as anything other than a root node, so it's the only case where it ought to be safe to allow a nameless Node instance.

@isaacs isaacs merged commit bf04701 into main Dec 1, 2020
@ruyadorno ruyadorno deleted the fix-run-from-system-root branch December 2, 2020 15:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants