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.
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).
I'm trying to update nodejs and cordova.
In got the latest version of nodejs and installed it into c:\program files\nodejs
However there is some conflict when i try to install cordova
npm install -g cordova
Npm shows the version installed in visual studio and closes:
c:\ProgramData\Microsoft\VisualStudio\MDA\3614fb17\taco-toolset-6.3.1\node_modules
I tried most of the solution found on stackoverflow and many others on google nothing. manual change of the version in config.xml will simply crash the app and thats all.
How to update it?
Best solution as far.
I gave up on visual studio and using my good old Edit Plus IDE and using cordova in command line to build / run etc.
Versions
Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586
VS TACO Update 10
TypeScript 2.4.1
What i have done
i set External tools to global nodejs
https://i.stack.imgur.com/PRqR8.jpg
i changed cordova cli from 6.3.1 to 6.5.0... using the article of the taco page.
3.i used cmd to navigate to the cordova project folder in my solution like "D:\Projects\XYZ\LM\LM.CordovaApp (LM.Cordova is project in VS2015 solution). then i try to update my cordova-android (it installed version6.2.3). i'm used the commands:
cordova platform remove android
cordova platform install android
Errors
After Build:
MSBUILD : cordova-build error BLD401: Error : BLD00401 : Could not find module 'D:\Projects\XYZ\LM\LM.CordovaApp\node_modules\vs-tac\app.js'. Please Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache and try building again.
this is not exactly the same error like this "Could not find module ‘C:\Users{name}\AppData\Roaming\npm\node_modules\vs-tac\app.js’. Please Go to Tools –> Options –> Tools for Apache Cordova –> Cordova Tools –> Clear Cordova Cache and try building again", which i can find many solutions, but my error doesn't point to the global npm node_modules, it points to the node_modules of my project and in my global Roaming\npm\node_modules is a vs-tac directory.
Clear Cordova Cache doesn't help.
Clear npm cache + Cordova Cache doesn't help.
after looked over this page "https://decoupledlogic.com/2016/05/11/fixed-error-building-cordova-in-visual-studio/", i had an idea... i add to my package.json of the project the dependency:
"vs-tac": "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\Extensions\\ApacheCordovaTools\\Packages\\vs-tac"
now i restored package, rebuild and the error changed....to:
BLD00401 : Could not find module 'elementtree'. Please Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache and try building again.
but i can ses in my project node_modules the directory "elementtree"....
Clean Cordova Cache doesn't help.
no i'm out of ideas.
have anyone a idea or solution??? how can update cordova-cli and cordova platforms of a Visual Studio Cordova Project correctly?
actually i rolled back to cordova-cli 6.3.1 and the old platform versions...
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'.
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.