Reputation: 2262
I am trying to use the native Screen Orientation plugin, but Ionic refuses to use it. I am following the docs and tried this:
ionic cordova plugin add cordova-plugin-screen-orientation
npm install --save @ionic-native/screen-orientation
The npm
command works and installs fine, but Ionic refuses to install the plugin and says that it's not in the repository.
Ancient Google-fu wisdom brought me to this bug report:
https://github.com/ionic-team/ionic-native/issues/1778
Which offers the following solution:
cordova plugin add https://github.com/Exilz/cordova-plugin-screen-orientation.git --save
But, but... isn't it a bad idea to directly install a plugin to Cordova, without Ionic?
Here is what actually happens on ionic cordova plugin add cordova-plugin-screen-orientation
:
> cordova plugin add cordova-plugin-screen-orientation --save
C:\Program Files (x86)\OpenSSH\bin\sh.exe (10140): *** couldn't allocate cygwin heap, Win32 error 0, base 0x7F0000, top 0x7F5000, reserve_size 20480, allocsize 20480, page_const 4096
Error: Failed to fetch plugin git+https://github.com/Exilz/cordova-plugin-screen
-orientation.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf: Cloning into 'C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf'...
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf: C:\Program Files (x86)\OpenSSH\bin\sh.exe (10140): *** couldn't allocate cygwin heap, Win32 error 0, base 0x7F0000, top 0x7F5000, reserve_size 20480, allocsize 20480, page_const 4096
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf: 1 [main] sh 8964 sync_with_child: child 10140(0x1BC) died before initialization with status code 0x1
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf: 164 [main] sh 8964 sync_with_child: *** child state waiting for longjmp
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf: Cannot fork: Resource temporarily unavailable
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf: fatal: Could not read from remote repository.
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf:
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf: Please make sure you have the correct access rights
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf: and the repository exists.
npm ERR! git clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "git+https://github.com/Exilz/cordova-plugin-screen-orientation.git" "--production" "--save"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! code 128
npm ERR! Command failed: git -c core.longpaths=true clone C:\Users\tomcat\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-Exilz-cordova-plugin-screen-orientation-git-16e251fa C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf
npm ERR! Cloning into 'C:\Users\tomcat\AppData\Local\Temp\npm-9328-8a7aefe6\git-cache-cc84988e\bb17ab18427b91ea61289a7f6ab3a8bac822fecf'...
npm ERR! C:\Program Files (x86)\OpenSSH\bin\sh.exe (10140): *** couldn't allocate cygwin heap, Win32 error 0, base 0x7F0000, top 0x7F5000, reserve_size 20480, allocsize 20480, page_const 4096
npm ERR! 1 [main] sh 8964 sync_with_child: child 10140(0x1BC) died before initialization with status code 0x1
npm ERR! 164 [main] sh 8964 sync_with_child: *** child state waiting for longjmp
npm ERR! Cannot fork: Resource temporarily unavailable
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! f:\Cordova\timelapser\npm-debug.log
[ERROR] An error occurred while running cordova plugin add cordova-plugin-screen-orientation --save (exit code 1).
Funny enough, but it seem to work if I preview the app in the new Ionic DevApp. It doesn't work if I properly build it and run on an Android phone.
Upvotes: 0
Views: 335
Reputation: 2262
OK, the solution is damn simple. I downloaded the plugin from the git repo as a zip, opened into a directory and installed it from there. Certainly something is off with OpenSSL at me, or it may be the repo, because other Ionic plugins install correctly.
Upvotes: 0