我在从cordova安装插件时遇到一些问题,因为我收到此错误:
SyntaxError: Unexpected end of input
命令:
cordova -v
结果:
4.3.0
命令:
cordova plugin add org.apache.cordova.camera
结果:
Fetching plugin "org.apache.cordova.camera" via plugin registry
SyntaxError: Unexpected end of input
at Object.parse (native)
at getJson (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\util\metadata.js:29:31)
at Object.exports.save_fetch_metadata (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\util\metadata .js:56:24)
at C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:148:18
at _fulfilled (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:749:13)
at C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:557:44
at flush (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:419:13)
命令:
cordova plugin add https://github.com/phonegap-build/PushPlugin.git
结果:
Fetching plugin "https://github.com/phonegap-build/PushPlugin.git" via git clone
SyntaxError: Unexpected end of input
at Object.parse (native)
at getJson (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\util\metadata.js:29:31)
at Object.exports.save_fetch_metadata (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\util\metadata .js:56:24)
at C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:148:18
at _fulfilled (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:749:13)
at C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:557:44
at flush (C:\Users\Mayank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:419:13)
在我的项目文件中似乎有些变化,因为相同的插件正确添加而没有新项目中的任何错误。但我真的没有得到改变。
答案 0 :(得分:3)
我的fetch.json也损坏了。我通过jsonlint.com运行它,并立即找到了丢失的逗号。
答案 1 :(得分:1)
现在已经有一段时间了,但我刚刚通过恢复fetch.json文件上的更改来解决这个问题,该文件在合并后已损坏。