question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid command line switch for "cmd.exe" System.argumentException: Item has already been added. (PATH vs Path)

See original GitHub issue

Hello,

When building my package with Git Bash shell I receive the following error:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(238,5): error MSB6001: Invalid command line switch for "cmd.exe". System.ArgumentException: Item has already been added. Key in dictionary: 'Path'  Key being added: 'PATH' [C:\${snip}\build\ZERO_CHECK.vcxproj]

I think this issue is very closely related to this issue: https://github.com/dotnet/msbuild/issues/5726

The problem is not clear how to fix, though MSBUILD suggests that this is a “wontfix” and that I should work around the issue. But it’s not clear what to add to my cmake-js usage to work around this issue. It’s seems the workaround is required in cmake-js?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gentuniancommented, Jun 3, 2021

Going through the code it looks like in master this was addressed as a specific workaround:

https://github.com/cmake-js/cmake-js/blob/e311b71564be3925f35f0861f85817a823d4cff0/lib/processHelpers.js#L12

If the sanitize in nodejs could be backported, probably that hardfix could be removed as well.

1reaction
gentuniancommented, Jun 3, 2021

I tracked the issue down to https://github.com/nodejs/node/pull/35210 so if this could be backported to older versions of nodejs then this issue I think will disappear.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error MSB6001: Invalid command line switch for "CL.exe". Item ...
The error message is complaining that the environment variable PATH is being duplicated. How are you getting to the command line?
Read more >
Developers - Invalid command line switch for "cmd.exe" System ...
Invalid command line switch for "cmd.exe" System.argumentException: Item has already been added. (PATH vs Path)
Read more >
Migrated the project from VS2003 to VS2019. After that ...
CppCommon.targets(502,5): error MSB6001: Invalid command line switch for "CL.exe". System.ArgumentException: Item has already been added.
Read more >
MSB6001: Invalid command line switch for "cmd.exe". | Qt + ...
Hi I've got problem with Visual Studio Express 2013. When I want to compile the code it drive me crazy. Beacause I was...
Read more >
NGT - The system cannot find the file specified. cmd.exe /c net ...
If "C:\Windows\System32\WindowsPowerShell\v1.0\" is not present in the PATH variable as shown above or path entry is corrupted the PATH value ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found