问题
when i build cordova project it working fine. output also shown.But, after few minutes later it shows this error
Error: Failed to fetch platform cordova-browser@~5.0.0
PS C:\Users\Rajadurai\Desktop\app> phonegap serve
[phonegap] starting app server...
[phonegap] listening on 127.0.0.1:3000
[phonegap]
[phonegap] ctrl-c to stop the server
[phonegap]
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6UXY64
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6UXY79&sid=rXL4l2-OqPKmfZW6AAAA
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6UXY7l&sid=rXL4l2-OqPKmfZW6AAAA
[phonegap] 200 /
[phonegap] 304 /socket.io/socket.io.js
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6UXYG2
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6UXYJ5&sid=zpW7GDvt1Qd-4P4fAAAB
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6UXYJg&sid=zpW7GDvt1Qd-4P4fAAAB
[phonegap] 200 /
[phonegap] 304 /socket.io/socket.io.js
[phonegap] 200 /
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6UXg9G
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6UXg9j&sid=c-F51GuDrgqwHErsAAAC
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6UXgA9&sid=c-F51GuDrgqwHErsAAAC
Using cordova-fetch for cordova-browser@~5.0.0
Error: Failed to fetch platform cordova-browser@~5.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! enoent request to https://registry.npmjs.org/cordova-browser failed, reason: getaddrinfo ENOENT registry.npmjs.org:443
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! C:\Users\Rajadurai\AppData\Roaming\npm-cache\_logs\2018-02-16T12_12_00_250Z-debug.log
Screenshot Please help me to reslove this issue
回答1:
Remove the platform which you try to run on it (browser, ios, android, and etc.)
For example (run cmd, locate to your project folder and type):
cordova platform rm browser
Add the platform again
cordova platform add browser
You can run
cordova run browser
来源:https://stackoverflow.com/questions/48826923/cordova-error-failed-to-fetch-platform-cordova-browser5-0-0