Cannot find module 'q' - android

I have met this trouble in both VS2013Up4 and VS2015Pre. My OS is Win8.1 Pro x64. The detail message about the error:
Cannot find module 'q' MDAVSCLI 1 1 WinJSToDo.
And I can get nothing from double click it. Please help me. ORZ...
Currently I'm using Visual Studio 2013 update 4 with Visual Studio Tools for Apache Cordova extension on Windows 8.1. I create a new Cordova JavaScript Blank project and then trigger a build, it turns out to be below building error:
Error 2 Cannot find module 'q' C:\Users\penlv\documents\visual studio
2013\Projects\BlankCordovaApp1\BlankCordovaApp1\MDAVSCLI 1 1
BlankCordovaApp1
Seems many other users run into the same issue. Any help on this?

You can try this link if works.
And also this.
I tried but still have the same error.
Finally i have 'Cannot find module' error fixed:
copy 'lib' and 'resource' folder from 'C:\Program Files\nodejs\node_modules\vs-mda' to 'C:\Users\[user-name]\AppData\Roaming\npm\node_modules\vs-mda'
in 'C:\Users\[user-name]\AppData\Roaming\npm\node_modules\vs-mda' folder, run npm install command

I had this issue when my "User Account Control" was switched on (Windows 8.1).
The solution was to run Visual Studio as Administrator, and then clear your cordova cache, and rebuild.

Related

Cordova fail when try to build Android app with error "Command failed with exit code 2" Linux

I'm using Ubuntu Gnome 14.04 64 Bit (for the moment) with kernel 3.19.0-33-generic.
I created a new app (a clean one, no plugin, no www folder with content) to try to build it.
After type in the bash "cordova build android"
I get this error:
Running command: /home/aby/Desktop/testApp/platforms/android/cordova/build
[Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.]
ERROR building one of the platforms: Error:/home/aby/Desktop/testApp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/aby/Desktop/testApp/platforms/android/cordova/build: Command failed with exit code 2
Now if you printenv | grep android
You will get
ANDROID_HOME=/opt/android-sdk-linux
ANDROID_PLATFORM_TOOLS=/opt/android-sdk-linux/platform-tools
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/home/aby/bin:/home/aby/opt/jdk8/jdk1.8.0_45/bin:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools
ANDROID_SDK=/opt/android-sdk-linux
You can see that the variables exist, in fact before I run cordova build android I had to use cordova platform add android and its works with no problem.
So I found this Bug, and tried some solution like update android(project) or remove and install it again with no success.
I reinstall the Andoroid SDK, and updated the "/.bashrc", "/.profile" and "~/.pam_enviroment" with the environment values and also this not help.
So how can I fix this? How can I build my app with no error? What I missing?(If you consider that you need another information please tell me).
Thanks, in advance.
At the end I could fix my problem when I change the "Owner" / "Group" to the android sdk folder and Permission to "/tools/android".
Here a link to my previous question, and the solution (at least for me) to fix this error.

Visual Studio 2015 hangs when create/open a Cordova project

I used Visual Studio 2015 to develop mobile app with Cordova. Before I upgraded to Windows10, I was using Windows 7 and it worked perfectly fine. After I've upgraded to Windows10, whenever I open a Cordova project or create a Cordova project the Visual Studio hangs (not responding).
I have tried to reinstall the Visual Studio but it still hangs.
Anyone has faced this problem before?
Thanks
Here is the solution for this problem in VS 2015. This issue if you have Windows 10 and latest updates in VS 2015 including latest type script installation.
1) Open command prompt as administrator.
2) Navigate to the following folder path:
cd "C:\ProgramData\Package Cache"
3) write the following command to find out vs_edition.exe file:
dir vs*exe /s /b
4) copy the full path that contains your vs edition exe from the screen.
5) write the following command:
"C:\ProgramData\Package Cache\{GUID}\vs_enterprise.exe" /modify /installselectableitems Javascript
6) VS installer will start, click on modify and then update. no need to change any features selection.
7) Wait until the installer finishes.
8) From the command prompt, navigate to the following folder:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
9) Run the following commands:
devenv /updateconfiguration
devenv /clearcache
Below screenshot shows the full commands set.
Now, you will be able to open VS 2015 and create cordova apps.
This is a known issue, and the solution is mentioned in the following link.
I still had few more issues with the Blank Cordova Project which would simply not build once the hanging issue was fixed. I'll share my experience here to help others.
After recovering from the VS.Net2015 hanging I was still getting
"Error MSB3073 The command "platforms\android\cordova\clean.bat" exited with code 1. BlankCordovaApp7 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets 354"
I tried reinstalling the Android Studio again and found that it was not working, and the issue was: I had installed a 32 bit Java SDK on 64Bit OS. After In installed the 64Bit JDK and correcting the Path variable to point to this directory, I was able to start the Android Studio.
Now my Blank Cordova project was still not compiling with an error
'MySQL' is not recognized as an internal or external command, BlankCordovaApp7 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets 287
This was an interesting one, looks like its an issue with MySQL, in the PATH variable there were some & within the path. I used "" to surround those path
Now its compiling and also able to start the Ripple.
Hope it helps someone as it took me more than 2 weeks to fix.
Regards
Kiran
Today , solved for me with Visual Studio Tools for Apache Cordova Update 2 for VS2015 Enterprise & Windows 8.1. ;-)
I think there are some updates for Visual Studio 2015. I reinstalled it and it is working now.
Here is what I did:
Uninstall the Visual Studio 2015 using the installer (vs-community.exe) from https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx
Install Visual Studio 2015 using the same installer(vs-community.exe) and choose Typical Installation
After the installation is done, run the installer (vs-community.exe) again and choose Custom Installation and choose to install Apache Cordova
Then I am able to open and build Cordova project
Not sure if this helps.
In my case with VS2015, the problem was about missing SDK build tools for Android. The lack of information is due to the fact that Visual Studio does not show all the build information by default. Once more information is shown, we could see issues with third party dependency issues like Android build tool. There are a couple of ways to get more information during a build.
MSBuild build output verbosity
Dependency checker on the Cordova tools
Both of these are available from the tools menu. For more information see this post:
http://www.ozkary.com/2016/01/visual-studio-2015-apache-cordova.html
hope it helps.

Please install Android target: "android-21" but it is installed?

My problem
I have been using the Tools for Apache Cordova template in visual studio to build an app it has been working for me for like two months no problem at all but then suddenly yesterday after I built it like 6 times it just stopped working.
In VS you get some really bad build errors that don't tell you much about the problem like:
Severity Code Description Project File Line Source
Error C:\Konstruktion\MyFirstApp\MyFirstApp\MyFirstApp\platforms\android\cordova\build.bat: Command failed with exit code 1 MyFirstApp C:\Konstruktion\MyFirstApp\MyFirstApp\MyFirstApp\ERROR building one of the platforms 1 Build
and
Severity Code Description Project File Line Source
Error C:\Konstruktion\MyFirstApp\MyFirstApp\MyFirstApp\platforms\android\cordova\build.bat: Command failed with exit code 1 MyFirstApp C:\Konstruktion\MyFirstApp\MyFirstApp\MyFirstApp\MDAVSCLI 1 Build
So I did try to build it without the help of visual studio with just the CMD commands this was the error I then got:
[Error: Please install Android target: "android-21"]
Hint: Open the SDK manager by running C:\Users\username\AppData\Local\Anndroid\sdk\tools\android.BAT
You will require:
1. "SDK Platfrom" for android-21
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools (latest)]
Error: cmd: Command failed with exit code 2
at ChildProsses.whenDone (C:\Users\myUsername\AppData\Roming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at mybyClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
(This is handwritten sens I don't know how copy to the entire output from cmd if you know I can update the question).
Things I have tried so far
re-install the asked tools and sdk platforms via SDK manager
re-install the entire sdk
this Stack Overflow question
What will I try today?
The awesome solutions readers can come up with!
Install everything on a different computer and try there
Try it on windows-10 (like that will help)
Images
I found why the problem appears. This is a problem that only affects user how uses Cordova tools for Visual Studio! (I think).
If you start a build and then cancel it if you have device or emulator selected it will corrupt some files in the debug folder:
C:\Konstruktion\myApp\myApp\myApp\bin\Android\Debug
or where you have put it.
If you don't know where it is just right click the project name in the solution explorer and then click "Open path in File Explorer"
Navigate to the debug folder and delete it's contents, build again and it should work again.
bin\Android\Debug

:app:preDexDebug ... The system cannot find the path specified

Please do not mark this questions as a duplicate - I have diligently searched SO for a satisfactory answer and have found nothing that worked for me.
I downloaded the very latest version of the Android Studio and attempted to install it on two Windows 7 PC's - a laptop and desktop with identical configurations of JRE and JDK. Results:
laptop: can use Android Studio to build/run first Hello World app; everything seems fine.
desktop: Hello World builds successfully, but will not run. Reports gradle error:
:app:preDexDebug
The system cannot find the path specified.
I have spent 3 days now researching this error on SO and elsewhere and have tried everything suggested (edit dx.bat, edit find.java.bat, JAVA_PATH, gradlew --stop etc) but nothing works for me.
Configuration:
- Android SDK Tools 24.0.1
- Android SDK Platform Tools 21
- Android SDK Build Tools 21.1.2
I am on the verge of giving up on my desktop installation of Android Studio.
Any new suggestions?
Please help!
This has something to do with an error in your Gradle build process. You'll need to clean the project and rebuild to fix this. An easy way to do this is from the root folder of your project run ./gradlew clean

Issue with WIndows MDHA with visual studio 2013

I'm trying to learn something about multy hybrid app developing under visual studio 2013 using Apache Cordova. I've just created a new project and i'm trying to build it but when I try to build it for android I get 1 warning and 1 error.
warning:
Warning 1 The TypeScript Compiler was given no files for compilation, so it will skip compiling. C:\Program Files\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript\Microsoft.TypeScript.targets 95 5 helloWorld
error:
Error 2 The command ""C:\Users\user01\AppData\Roaming\npm\node_modules\vs-mda\vs-cli" build --platform "Android" --configuration "Debug" --projectDir . --projectName "helloWorld" --language "en-US" --buildServerUrl "" --buildTarget "AndroidEmulator"" exited with code 1. C:\Users\user01\AppData\Roaming\npm\node_modules\vs-mda-targets\Microsoft.MDA.targets 99 5 helloWorld
I've googled those errors but I haven't sorted anything out. Do you know what is the problem?
The issue is because of Android target (latest version) is not available with Android SDK. Make sure the following in your system,
Go to Android installed folder (for me, C:\Users\username\AppData\Local\Android\android-sdk)
Go to tools folder and select "android.bat" Run as Administrator
Check whether the latest version of Android (ex: API 19) is installed or not
If it is not installed, select that API, click install by accepting License
If it is installed, close it and then Go to to root folder(ex: C:\Users\username\AppData\Local\Android\android-sdk)
Double click on the AVD Manager and create new AVD
Now I hope, you can able to build and run the application.

Categories

Resources