Visual Studio 2022: Cannot create a project named "tempProjectCreation" because of npm naming restrictions - visual-studio-2022

I'm trying to create a new Typescript project in Visual Studio 2022 Community Edition.
I've installed Visual Studio 2022 Community Edition (Windows), as well as Node.JS v18.12.1-x64 for Windows.
In the Visual Studio Installer (v17.4.2) I clicked the "Node.js development" workload and installed it.
I then opened Visual Studio 2022 Community and clicked "Standalone Typescript React Project" from the "Create New Project" page.
While creating the project, a command window opens and the following error occurs in a command window (cmd.exe) that was launched from Visual Studio:
C:\Program Files\nodejs\npx.cmd --yes create-react-app "C:\Users\Admin\source\reactproject1\tempProjectCreation" --use-npm --template typescript && cd /D C:\Users\Admin\source\reactproject1\tempProjectCreation && npm i --save-dev jest-editor-support eslint-config-react-app
Cannot create a project named "tempProjectCreation" because of npm naming restrictions:
* name can no longer contain capital letters
Please choose a different project name.
Press any key to continue . . .
The IDE fails to create the new react template site. Apparently Node.js now forbids Uppercase for file portability reasons.
The solution would seem simple (as the error points out) - simply change the name of "tempProjectCreation" to "tempprojectcreation" (lowercase) and it should work. In fact, I executed the "npx.cmd" command above and renamed the tempProjectCreation to tempprojectcreation" and the website generated without issue!!
I have googled and searched my hard drive and cannot find the Visual Studio template script that might be invoking the error. In fact, I can't find where Visual Studio Template scripts are stored from my
Where are the Visual Studio Template scripts? I've looked in "C:\Users{UserName}\AppData\Local\Microsoft\VisualStudio\17.0_0d978569 and they don't appear to be there.
Are they editable? Is it possible to change the "tempProjectCreation" to lowercase "tempprojectcreation"?
As this is a configuration question, I'm not sure if I am missing any debug information besides the error emitted above, but I'll edit this question if necessary.

here are the steps that I've taken in order to be able to create a standalone React Typescript project with Visual Studio 2022 (on Windows):
open a windows console (cmd) and uninstall then locally reinstall the create-react-app :
npm uninstall -g create-react-app
npm install -g create-react-app
Navigate to this folder: C:\Users\[your_ username]\AppData\Roaming\npm\node_modules\validate-npm-package-name
Edit index.js and comment out these lines of code:
if (name.toLowerCase() !== name) {
warnings.push('name can no longer contain capital letters')
}

Related

Where is cmake located when downloaded from visual studio 2022

Where is cmake located when downloading it from visual studio 2022 as I wanted to add it in environmental variables
Launch the Native Tools Command Prompt (accessible via the Start Menu). From here you can run:
> where cmake
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe
to determine the location. I expect that for VS2022 the path will be very similar.
However, the version of CMake distributed with Visual Studio has patches from Microsoft. You should either install upstream CMake for use outside of the Native Tools Command Prompt, or just use the Native Tools Command Prompt.

visual studio code CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory

I am new to javaScript, trying to set up Visual Studio Code.
I have installed NodeJs and Visual Studio Code, with windows Powershell.
In visual studio > terminal if I run npm view command I am getting following error
CMD .EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
npm ERR! Invalid package
Can anyone please take a look at this issue. Is this because of restrictions on corporate systems?
It looks like your project directory (and your profile) is stored on a network fileshare, which is quite common in corporate environments.
You can ask your IT to create a mapped drive with your profile, or you can use the pushd command to create a temporary mapping.
Before opening the project in Visual studio run this from your command line (replace the path with your actual UNC path):
pushd \\corpserver\share$\jdoe\projects\java\...
the command will place you in the newly created temporary drive.
Copy the new temporary path
Open Visual Studio Code and open your project from this temporary path
You should now be able to use terminal and build/run scripts
In my case, I forgot to install NodeJS in WSL. Then, node was taken from Windows.
> which node
/mnt/c/Program Files/nodejs/node.exe
Installing NodeJS on my WSL did the trick
> sudo apt-get install nodejs

How to open dotnet-core CLI project in Visual Studio 2017

I have been developing a simple application using dotnet Core (for an API) and Angular2 for the purpose of learning both.
I created the project using Yeoman on the command line and have been happily coding away in Visual Studio Code (on Windows). All seems to hang together well and it's been an enjoyable experience.
I thought I might try out Visual Studio 2017 and see what the experience of developing a dotnet Core project in VS is like for a while.
However, having installed VS2017 and cloned the project from github I am unsure how to proceed. I can't see any way to restore/build/run the project.
After cloning the repo, I see my project displayed in the Solution Explorer with the project.json file visible. However, Debug | Start is greyed out. I read somewhere about VS2017 needing to convert project.json to the new (old?) XML format and also I have a feeling I am missing a .sln file.
I would appreciate it if someone could point me in the right direction.
If your project has an .xproj file
Open Visual Studio.
File > Open > Project/Solution.
Open the xxx.xproj for your solution.
If your project lacks an .xproj file
Install .NET Core SDK Preview 3 or higher.
Open a command prompt at your project's directory.
Run dotnet migrate.
Open the resulting .csproj in Visual Studio 2017.
Troubleshooting
View migration help with dotnet migrate -h.
If you have a global.json file, update its SDK version before running migrate. E.g.
{
"sdk": {
"version": "1.0.0-preview4-004233"
}
}
View installed SDK versions with dir 'C:\Program Files\dotnet\sdk\'.
Update Visual Studio 2017 and its installer. On my machine, the above works with Microsoft Visual Studio Community 2017 RC Version 15.0.26014.0 D15REL.
Update .NET Core SDK. On my machine, the above works with SDK 1.0.0-preview4-004233.

How to install grunt globally in VS2015

I tried the following, but get this exception:
You might check, you might need to run a command prompt with elevated permissions in order to install globally.
Just a note, Visual Studio comes with it's own archaic versions of Node and Grunt, so if you go to the Quick Launch Toolbar in the upper right-hand corner of the screen and type "External Web Tools" you can force Visual Studio to use the globally-installed version. Just add a path to the global Grunt installation and move it to the top of the list. Close Visual Studio and re-open and you should be all set.

'npm' is not recognized as an internal or external command error in Developer Command Prompt for VS2015

I am trying to execute npm install –g tsd in Developer Command Prompt for VS2015.
But it returns
'npm' is not recognized as an internal or external command,
operable program or batch file.
Any idea?
To solve this issue in Visual Studio 2017 (and above), make sure to install the NodeJS tools in the VS installer.
To launch it, go to Control Panel -> Programs -> Programs and Features, scroll down to Visual Studio 2017 and click Change.
Choose Modify in the installer.
Check the Node.js development checkbox and click Modify to complete the installation.
Download / Install NodeJS tools for Visual Studio; that'll fix the issue and give you intellisense among other benefits!
https://github.com/Microsoft/nodejstools
This solution is specifically for Visual studio code editor.
The easiest way to solve that, is to install plugin for node.js using VS code editor,
To do that follow the steps.
click on Extension Icon, and type in search box node.js, It will give you search result.
Look for the node.js Extension pack.
It should look like the bellow screen, I have already install, the extension. That is why, the green install button is not visible, Just hit on install, once finished. Restart the VS code. now it should work for sure.
You can install Node.js from https://nodejs.org/en/. 'npm' may be unrecognized in Visual Studio 2017 and Win 10 OS when node.js package is not found. After installing node.js package, it will automatically add '..\nodejs' value in Environment variable 'PATH'. Once node.js package is installed, restart your Visual Studio 2017 to Rebuild your project again.