安装SQLite的cordova插件时出错

时间:2018-02-16 07:43:37

标签: git sqlite cordova npm

我正在尝试使用以下命令为SQLite安装插件:

cordova plugin add https://github.com/litehelpers/Cordova-sqlite-storage.git

但我得到以下内容:

C:\Users\om\sunapp>cordova plugin add https://github.com/litehelpers/Cordova-sqlite-storage.git
(node:8180) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Failed
to fetch plugin https://github.com/litehelpers/Cordova-sqlite-storage.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 WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Program Files\nodejs\node_modules\npm\node_modules
\which\which.js:14:12)
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js
:69:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js
:81:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:90
:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_module
s\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_module
s\isexe\windows.js:29:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyf
ills.js:264:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15)
npm WARN addRemoteGit  git+https://github.com/litehelpers/Cordova-sqlite-storage.git resetting remot
e C:\Users\om\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-litehelpers-Cordova-sqlite
-storage-git-c710b464 because of error: { Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Program Files\nodejs\node_modules\npm\node_modules
\which\which.js:14:12)
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js
:69:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js
:81:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:90
:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_module
s\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_module
s\isexe\windows.js:29:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyf
ills.js:264:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\om\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror
 https://github.com/litehelpers/Cordova-sqlite-storage.git C:\Users\om\AppData\Roaming\npm-cache\_gi
t-remotes\git-https-github-com-litehelpers-Cordova-sqlite-storage-git-c710b464: undefined
npm ERR! git clone --template=C:\Users\om\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror
 https://github.com/litehelpers/Cordova-sqlite-storage.git C:\Users\om\AppData\Roaming\npm-cache\_gi
t-remotes\git-https-github-com-litehelpers-Cordova-sqlite-storage-git-c710b464: undefined
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\b
in\\npm-cli.js" "install" "https://github.com/litehelpers/Cordova-sqlite-storage.git" "--production"
 "--save"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ENOGIT

npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\om\sunapp\npm-debug.log

我是第一次这样做而且不明白这是什么问题。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

你的系统上没有安装git。

尝试

 git --version

检查是否安装了git。

如果它不打印版本,那么你必须通过以下命令安装git:

sudo apt-get install git-all

安装git后,您可以尝试添加插件。

cordova plugin add https://github.com/litehelpers/Cordova-sqlite-storage.git

希望这会有所帮助。 干杯:)