I installed visual studio 2015.
Then I run the npm.cmd command (which is installed when installing Visual Studio) (in a cmd window which I started as administrator) to install karma with these commands:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\npm.cmd" install -g karma
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\npm.cmd" install -g karma-cli
I understood that this will install Karma globally, so I can run it from anywhere.
But when I try to run karma (even when I am in the folder I was when I ran the npm commands), I get the 'karma' is not recognized as an internal or external command, operable program or batch file. message.
What am I missing here?
Did not get it to work with the Node version which was installed with Visual Studio.
Node, as installed with Visual Studio, is a sort of, I don't know how to call it, 'side install' or 'embedded install'. It's not the real NodeJs I guess and it's installed in the Visual Studio directories. (I also do knot know how it gets updated and how security updates are made).
I ended up installing the 'normal' NodeJs which worked instantly.
All the paths were setup correct so when I installed NodeJs, I could run npm from every folder and when I ran the Karma installs I could also start the Karma from every location.
So I stopped looking for the solution with the 'with Visual Studio preinstalled version' and ended up working with the 'normal NodeJs'.
Related
Using: Windows 10, Visual Studio 2022 17.1.0 (soon to be updated).
I come from the age when I would just copy the JavaScript files of a library in a subfolder of my website/application, add some <script...> tag to the adequate pages and call it installed...
But right now I'm trying to initiate my first Angular 2+ project. I'm trying to start from "Standalone TypeScript Angular Project" template.
But Visual Studio won't create my project, it writes in red
ng is needed (...)
npm is needed (...)
So I checked how to install ng... I needed npm, I checked how to install npm... I read it's recommended to install it through nvm... so I installed nmv, then npm, then ng ( v16.15.1 )... but Visual Studio still won't create my project and keeps requiring npm and ng.
What am I missing?
(I tried searching the Internet but mostly found a bunch of unrelated references and dead links.)
Here are the precise things I ran so far:
nvm-setup.exe
(I installed it in a custom folder of D:\ as I want this kind of tools to go there.)
nvm install lts
This installed npm in a subfolder of my customer folder.
npm install -g #angular/cli
This installed ng in a the same folder as npm + a subfolder.
I added '[...]/v16.15.1' (which contains npm.cmd, ng.cmd and node.exe) to the PATH "environment variable", but the problem remains unchanged.
Solved: after previous step, I needed to restart Visual Studio, but as I kept re-launching Visual Studio from Visual Studio Installer, it didn't work as a restart. Effectively closing the Installer and just relaunching Visual Studio refreshed things and it finally worked.
Solved: I needed to add the path that contains npm, ng and node to Windows "user and/or system Environment Variables".
And I also needed to restart Visual Studio (including closing Visual Studio Installer).
My terminal in Visual Studio Code (as powershell) was open before I installed node/npm.
After installation, I tried npm -v and node -v to test within Visual Studio Code but it failed.
Now I restarted my Visual Studio Code, its terminals etc but while npm -v works in cmd/powershell of Windows (10) globally, without any problem
it is not recognized yet inside the cmd/powershell in Visual Studio.
I installed GTK+2 as instructed here: https://github.com/Automattic/node-canvas/wiki/Installation---Windows
I installed libjpeg-turbo
I installed Visual Studio 2015 Community
I installed node-gyp: npm install -g node-gyp
But when I run node-gyp rebuild I get:
Cannot open source file: '..\src\Canvas.cc': No such file or directory ... my_project_folder\build\canvas.vcxproj]
And when I run npm install canvas I get:
node-gyp\src\win_delay_load_hook.c(34): error C2373: '__pfnDliNotifyHook2': redefinition; different type modifiers ... my_project_folder\node_modules\canvas\build\canvas.vcxproj]
I am almost giving up... so easy on mac and linux... this is hell
I was struggling with it too at some point, The issue was resolved for me by running the npm command using "MSBuild Command Prompt for VS2015" (which should have being installed as part of Visual Studio 2015 installation which you did)
I have installed Visual Studio 2015 and it comes with nodejs and npm now. Prior to installing Visual Studio i had installed a 64 bit Nodejs and this is up to date.
When I am trying to add gulp-less dependency to package.json file fails. Having a look at the Bower/NPM outputs I do see an Warning
npm WARN engine hawk#3.1.0: wanted: {"node":">=0.10.32"} (current: {"node":"v0.10.31","npm":"1.4.9"})
I suspect the issues is related to visual-studio being a 32 bit process it load a different version of Node and for unknown release ignores the 64 bit node js. This happens despite the fact I have $(path) varible before "$(DevEnvDir)\EXTENSIONS\MICROSOFT\WEB TOOLS\External" in External Web Tools.
So question is how do I update the Visual Studio version of Node.
Okay got my solution.
1- Removed NPM and node from system -> path
2- Open command prompt with Administrator priviledge and navigate to visual studio install directory
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External
3- run npm install -g npm
that fixes the problem, also remember to restart visual studio afterwards.
I am trying to run the ripple emulator on Visual Studio, however I cannot seem to get pass the cannot find module './lib/plugin'error as follows:
C:\Users[user name]\Documents\Visual Studio 2013\Projects\Cordova\Cordova>call "C:\Program Files (x86)\nodejs\"\nodevars.bat
Your environment has been set up for using Node.js 0.10.33 (ia32) and npm.
------ Ensuring correct global installation of package from source package directory: E:\PROGRAM FILES (X86)\VISUAL STUDIO\COMMON7\IDE\EXTENSIONS\FUBXMEK2.O2B\packages\vs-mda
1>MDAVSCLI : error : Cannot find module './lib/plugin'
PS: The previous error I got was cannot find module 'q' however this was resolved by running npm install from CLI.
I am trying to create a Cordova application using Visual Studio. Any ideas how I can resolve the above error?
It seems something went wrong while installing vs-mda, you can try following to re-install:
Close Visual Studio
Open cmd
npm install -g [path to vs-mda example C:\Users[user-name]\AppData\Roaming\npm\node_modules\vs-mda]
npm install -g [path to vs-mda-targets example C:\Users[user-name]\AppData\Roaming\npm\node_modules\vs-mda-targets]
OR
Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache
For the second method above (Clear Cordova Data) try running visual studio as administrator if it fails the first time around.