Cordova run/prepare/build not doing anything, no errors - node.js

I installed cordova globally via npm (nodejs version 5.1.0)
Cordova v5.2.0
When I run cordova run android or cordova run or cordova build it does nothing, no errors, just a blank line (in powerShell no blank line at all)
Also with option --verbose or -d
Even when I make a completely new project it won't work.
Wat does work is cordova compile, but the compiled .apk is an old version. Probably because prepare moves the latest files from www into the platforms folder.
Now I could manually copy those of course, but that's not a solution to this.
I did just freshly install android studio and jre8, i thought it might need jre7, but after installing that, no change. (changed %PATH% var as well)
Then I remembered that cordova needs ant which is never mentioned here: https://cordova.apache.org/docs/en/latest/guide/cli/index.html
But after adding all the right %PATH% variables, still the same problem. Nothing.
I've been looking for error logs but I can't find any (%USERPROFILE%/.cordova). Any suggestions where to find them?
Furthermore, node works fine for the rest
I've tried removing and re-installing cordova as well.
I do see the npm.exe process running for about one second.
Also, running windows 10
javac 1.8.0_65
adb version 1.0.32

Related

Visual Studio Installer is not installing node.js

In Visual Studio Installer, I selected the Node.js development option. It runs successfully. But, if I try to run cmd node -v. It tells me node does not exist.
I tried a few other things including uninstalling and reinstalling the Node.js development option in VS Installer. Plus installing the latest version of node from the website.
However, when I try to run the pre-packed Angular solution that comes with VS 2017 I have issues. The solution will not even start.
The best I have been able to do is install Node 6.10.3. Once I do that, the web site comes up. But, I get a JavaScript error in the vendor.js file. I am able to continue but I get this error when I try navigate to another menu item. Plus the Hot Module Replacement does not seem to be working. (It does not automatically recompile my TypeScript file if I made a change).
I think the key is getting the Node.js development option installed correctly since I am able to run the pre-packed Angular solution on another PC and the Hot Module Replacement works fine.
Please let me know if anyone has any ideas on how to resolve.
I had a similar, if not the same, issue. Check the Visual Studio installation directory (2017 Professional in this case) for Node:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\NodeJs
If the executable is there, add the directory to your PATH.

"APK was defined multiple times" , app fails to install with Android Studio

My app was installing just fine... installing and reinstalling for testing, etc. But now it won't install anymore... and Android Studio says,
Application Installation Failed
Installation failed with message Failed to
finalize session :
INSTALL_FAILED_INVALID_APK: Split
lib_slice_3_apk was defined multiple times.
It is possible that this issue is resolved by
uninstalling an existing version of the apk if it is
present, and then re-installing.
WARNING: Uninstalling will remove the
application data!
Do you want to uninstall the existing
application?
[CANCEL] [OK]
I tried uninstalling the app from my phone, but it still won't re-install.
Also, I tried installing it fresh on an emulator where it had never been installed before, and that did not work either.
I suppose I must have inadvertently messed up some compile-related setting that I don't understand (but I haven't been doing anything like that). I don't have a knowledge of the compile process, and pretty much depend on Android Studio to do that.
I have been working on a "sister" app to this one... where I copied some libraries (.jar files such as zixng.jar from [project root]\app\libs) from this app to the other app. And that other app is installed on my phone also... but then again, it's not on the emulator... so I guess that's not the problem. Merp.
Thanks for any suggestions or possible explanations.
Try to clean & then Rebuild the project again. To do so please go to Build menu, both the tools are present their.
If issue not solved with that than try to invalidate caches & restart Android Studio from File menu -> Invalidate Caches/Restart.

Intellij 14 gradle fails to run bower command

I am just starting to play with the JHipster framework / code generator using intellij 14.1.5 on OSX Yosemite. I have a simple app with a couple of domain objects which I have imported into Intellij as a gradle project. When I attempt to run the app via the gradle build "run" task, the build fails on the bower command. I can successfully run this gradle task from the osx terminal app AND from withing Intellij's terminal window. It fails when I invoke the run task from the from the gradle tasks pane or if I run it from the "run configurations" drop down in the toolbar. It feels like it fails when Intellij invokes gradle, but succeeds when gradlew is invoked in a terminal. I'm not sure why there would be a difference in these environments / invocations.
I have installed npm/gulp/bower/yoeman via nvm/node and am up on current versions (installed today). Node is at 4.1.1.
Posting this answer because no one has posted one yet. I have followed the recommendation of this other post. It fixes the Intellij app launcher on the mac to recognize the path for node commands. The original technique is described in apple.stackexchange.com. I am using this technique with the latest Intellij Idea 2016.1.3 and Intellij invoked gradle runs bower / npm just fine.
Just update gradle version.
Open gradle/wrapper/gradle-wrapper.properties
and change version like
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip

Installing nvm for windows : Visual Studio npm debug fails because of illegal characters in path

the newest node.js 0.12.0 doesnt work together with the sqlite3 package. i found nvm for windows: nvm for windows https://github.com/coreybutler/nvm-windows/releases . i thought nice to use the old and new node.js versions on 1 computer.
after installing nvm for windows in c:\nvm , i get in visual studio 2013 in debug that there is a fault in npm : illigal characters in path resulting in exit debug program . Outside Visual Studio it works fine.
As I mentioned in my comment, I had a very similar problem. After installing node.js for purpose of using gulp I could not do a successful build. I would get the following error:
C:\Visual Studio
Projects\MyProject\packages\RazorGenerator.MsBuild.2.2.6\build\RazorGenerator.Ms‌​Build.targets(21,9):
error : Illegal characters in path.
After searching around I guessed that the problem had to do with the node.js utilizing "illegally" long path names. For some background go here: https://github.com/joyent/node/issues/6960
My solution was to install the Flatten Packages tool: https://visualstudiogallery.msdn.microsoft.com/cd0b1938-4513-4e57-b9b7-c674b4a20e79?SRC=VSIDE
I ran flatten packages on the "node_modules" folder, tried to build (failed but with a different error), restarted Visual Studio, and everything now seems to build ok. Hope this helps.
UPDATE
One thing to keep in mind is that, by design, Flatten Packages will move files up in the directory structure. As a consequence, however, Visual Studio will still look for some of the folder/files in the OLD location; VS will shows the [!] symbol to show that the file was there but no longer is. These old file references can gum up the build, so you need to simply delete these old file references/directories.
Since this post still is on top when searching for this topic..
I also had this problem with "Illegal characters in path" and found that the best solution for me and my team was to make Visual Studio use the latest npm version (>= 3.0) since the node_modules folder depth doesnt get as deep as with npm2 (used by Visual Studio).
This solution will work for you in the background, not needing to run extra commands and tools for flattening the folder.
See my post here for a complete how to: http://newsweb.se/how-to-use-visual-studio-2015-with-latest-nodejs-npm/

Phonegap 3.4.0 fails to build new projects and update old projects

I recently updated phonegap, node, and npm. I have an existing project I previously built with Phonegap version 3.3.0. I then attempted to update my existing project using phonegap platform update ios and received an error stating that the '/platforms' directory does not exist.
I don't think it makes any difference, but I also tried to use the cordova command instead of the phonegap command, but I just get the same error as above. I even created a completely new project with phonegap create Test and I am able to get a project built successfully, but when I try to run/build I get a similar error: Error: /platforms does not exist. Please specify an existing parent folder. [error] /Users/mftcmbp1/.cordova/lib/ios/cordova/3.4.0/bin/create: Command failed with exit code 1 Even stranger, I am able to successfully create a project with the cordova command, build ios and android platforms, and emulate the project, yet I can't do this with the phonegap command like I could before I updated.Any help or suggestions of why this would be occurring will be helpful.
Thanks!
Not sure if there is a bug with Phonegap 3.4.0, but I fixed my issue by uninstalling the latest Phonegap version and installing Phonegap version 3.3.0-0.19.4.
1- you need to 'cd' to your project and add platform first before build
cd Test
2- then add platform
iOS
phonegap platform add ios
android
phonegap platform add android
3- then you can build your project
iOS
phonegap build ios
android
phonegap build android
I ran into this over the weekend, have you tried:
$ mkdir project_directory/platforms
As I remember it, that solved the issue as a hotfix.
The error occured after a project was cloned from github without the platforms directory.
I ran into the same issue, and it looks like an error in the update script, and specifically this file:
node_modules/phonegap/node_modules/cordova/src/util.js
The quick fix is, in the function isRootDir, to change "config.xml" to ".cordova", i.e.:
- if (fs.existsSync(path.join(dir, 'config.xml'))) {
+ if (fs.existsSync(path.join(dir, '.cordova'))) {
The old version identified the base project directory via the existence of the .cordova directory. The new version is incorrectly looking for a directory that contains these three items:
www/
config.xml
platforms/
config.xml should not be in the base directory, it's under www/, which is why it fails.
The script does have fail-safe, which is to look for www/config.xml. However, the way it does this is to continue traversing the tree towards root, and if at any time it finds another www/config.xml, will assume this is a better candidate for the project directory.
In your situation, I'm guessing you have a /www/config.xml off of your root directory, and PhoneGap is erroneously thinking that is your project directory.

Resources