Ionic 3屏幕方向插件无法安装

时间:2017-11-01 15:26:46

标签: cordova ionic-framework cordova-plugins

我正在尝试使用原生Screen Orientation插件,但Ionic拒绝使用它。我正在关注文档并尝试了这个:

ionic cordova plugin add cordova-plugin-screen-orientation
npm install --save @ionic-native/screen-orientation

npm命令工作正常,但Ionic拒绝安装插件,并说它不在存储库中。

古老的Google-fu智慧带我到这个错误报告:

https://github.com/ionic-team/ionic-native/issues/1778

提供以下解决方案:

cordova plugin add https://github.com/Exilz/cordova-plugin-screen-orientation.git --save

但是,但是......如果没有Ionic,直接安装Cordova的插件是不是一个坏主意?

以下是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).

很有趣,但是如果我在新的Ionic DevApp中预览应用程序似乎有效。如果我正确构建它并在Android手机上运行,​​它就无法工作。

1 个答案:

答案 0 :(得分:0)

好的,解决方案很简单。我从git repo下载插件作为zip,打开到一个目录并从那里安装它。当然,OpenSSL对我来说是件事,或者它可能是回购,因为其他Ionic插件安装正确。