问题如下:
G:\Work\AMC>cordova plugin add cordova-plugin-app-version
(node:9884) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Failed to fetch plugin cordova-plugi
n-app-version 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 4294963238 Error output:
npm WARN myapp@1.1.1 No repository field.
npm WARN myapp@1.1.1 No license field.
npm ERR! path G:\Work\AMC\node_modules\_glob@7.1.3@glob\node_modules\fs.realpath
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'G:\Work\AMC\node_modules\_glob@7.1.3@glob\node_modules\fs.realpath' -> 'G:\Work\AMC\
node_modules\_glob@7.1.3@glob\node_modules\fs.realpath'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Nodejs\node_cache\_logs\2018-09-21T14_58_53_089Z-debug.log
(node:9884) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled w
ill terminate the Node.js process with a non-zero exit code.
重点信息如下:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1):
CordovaError: Failed to fetch plugin cordova-plugin-app-version via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
解决方法如下:
把代码中与 该插件相关的部分代码注释掉,在下载就可以了