You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi All. Apologies in advance as I am not a Software Engineer/Developer and am not a user of node.js, npm/npx, angular, and other related tools. I provide support for the machines used by our Software Engineers/Developers within the organization. As such I'm asking for a little grace here!
TL;DR: When a path contains special characters, specifically open & close parentheses, is it possible to escape those special characters when running npm/npx commands? What do we need to do to escape those special characters before running commands?
Details:
We have a situation in our environment where many Windows user profiles get created with special characters, specifically an open or open and closed parenthesis, due to their user profile directory matching their display name.
For example Matt Smith's user profile directory in C:\Users would be "MattSmith(Vendor)".
For example Bartholomew Smith's user profile in C:\Users would be "BartholomewSmith(Ve" - its truncated due to the length.
We have a about a hundred if not more people in this state in our environment and when they try to run npm/npx commands (from Visual Studio, VSCode, Webstorm etc.) the process fails presumably due to the parenthesis in the directory name. npx eslint . --config C:/Users/BartholomewSmith(Ve/Dir1/Dir2/.eslintrc.js --format html --resolve-plugins-relative-to C:/Users/BartholomewSmith(Ve/Dir1/Dir2
I say presumably because in the past when we've "fixed" the user profile name and they re-run the exact same commands, everything works the issue goes away.
Regarding the "fix": Since Windows doesn't support renaming user profiles, the "fix" is a little convoluted from either creating a whole new user profile or rebuilding the machine from scratch. This results in our SEs/Devs having need to reinstall everything making this a very expensive.
For future scenarios we should be able to address this proactively making it a non-issue, but updating their display name before they get setup on their machine. However this isn't always possible which is why we have a number of people in this state today.
Thanks in advance for any guidance you can provide on this.
Minimal Reproduction
Create a user profile on a machine that has at least 1 open parenthesis in their name.
Run an npm/npx command like: npx eslint . --config C:/Users/BartholomewSmith(Ve/Dir1/Dir2/.eslintrc.js --format html --resolve-plugins-relative-to C:/Users/BartholomewSmith(Ve/Dir1/Dir2
The process fails.
Output
I do not have any safe, sanitized examples to share at this time.
Before You Submit
I have looked for issues that already exist before submitting this
Certain command-line tools, including npm and npx, won't correctly handle these special characters unless properly escaped or quoted, as they will be seen as quantifiers/operators, rather than a raw string.
1. Quote the Paths (Best Practice)
Always enclose paths with special characters in double quotes ("):
npx eslint . --config "C:/Users/BartholomewSmith(Ve/Dir1/Dir2/.eslintrc.js" --format html --resolve-plugins-relative-to "C:/Users/BartholomewSmith(Ve/Dir1/Dir2"
This is the most reliable approach and should work in most cases.
2. Escape Parentheses in Paths
For command-line environments like PowerShell, escaping parentheses requires backticks (```):
npx eslint .--config C:/Users/BartholomewSmith`(Ve`)/Dir1/Dir2/.eslintrc.js --format html --resolve-plugins-relative-to C:/Users/BartholomewSmith`(Ve`)/Dir1/Dir2
For Command Prompt (cmd.exe), escaping requires carets (^):
npx eslint . --config C:/Users/BartholomewSmith^(Ve^)/Dir1/Dir2/.eslintrc.js --format html --resolve-plugins-relative-to C:/Users/BartholomewSmith^(Ve^)/Dir1/Dir2
Node.js Version
all versions
NPM Version
all versions
Operating System
Windows 11
Subsystem
Other
Description
Hi All. Apologies in advance as I am not a Software Engineer/Developer and am not a user of node.js, npm/npx, angular, and other related tools. I provide support for the machines used by our Software Engineers/Developers within the organization. As such I'm asking for a little grace here!
TL;DR: When a path contains special characters, specifically open & close parentheses, is it possible to escape those special characters when running npm/npx commands? What do we need to do to escape those special characters before running commands?
Details:
We have a situation in our environment where many Windows user profiles get created with special characters, specifically an open or open and closed parenthesis, due to their user profile directory matching their display name.
We have a about a hundred if not more people in this state in our environment and when they try to run npm/npx commands (from Visual Studio, VSCode, Webstorm etc.) the process fails presumably due to the parenthesis in the directory name.
npx eslint . --config C:/Users/BartholomewSmith(Ve/Dir1/Dir2/.eslintrc.js --format html --resolve-plugins-relative-to C:/Users/BartholomewSmith(Ve/Dir1/Dir2
I say presumably because in the past when we've "fixed" the user profile name and they re-run the exact same commands, everything works the issue goes away.
Regarding the "fix": Since Windows doesn't support renaming user profiles, the "fix" is a little convoluted from either creating a whole new user profile or rebuilding the machine from scratch. This results in our SEs/Devs having need to reinstall everything making this a very expensive.
For future scenarios we should be able to address this proactively making it a non-issue, but updating their display name before they get setup on their machine. However this isn't always possible which is why we have a number of people in this state today.
Thanks in advance for any guidance you can provide on this.
Minimal Reproduction
Create a user profile on a machine that has at least 1 open parenthesis in their name.
Run an npm/npx command like:
npx eslint . --config C:/Users/BartholomewSmith(Ve/Dir1/Dir2/.eslintrc.js --format html --resolve-plugins-relative-to C:/Users/BartholomewSmith(Ve/Dir1/Dir2
The process fails.
Output
I do not have any safe, sanitized examples to share at this time.
Before You Submit
The text was updated successfully, but these errors were encountered: