{"id":47318,"library":"cordova-fetch","title":"Apache Cordova Fetch","description":"A CLI tool for fetching Cordova plugins and platforms from Git repositories and npm registries. Currently at version 5.0.0, with low release cadence (last update ~2024). Key differentiator: integrates with Cordova's plugin/platform resolution logic, supporting semver and git references. Alternative to manual npm install or git clone for Cordova development.","status":"active","version":"5.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/apache/cordova-fetch","tags":["javascript","cordova","fetch","apache","ecosystem:cordova","cordova:tool"],"install":[{"cmd":"npm install cordova-fetch","lang":"bash","label":"npm"},{"cmd":"yarn add cordova-fetch","lang":"bash","label":"yarn"},{"cmd":"pnpm add cordova-fetch","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides Cordova project parsing and helper utilities","package":"cordova-common","optional":false},{"reason":"Parses npm package specifiers (e.g., version ranges, git URLs)","package":"npm-package-arg","optional":false},{"reason":"Cross-platform shell commands for git operations","package":"shelljs","optional":false}],"imports":[{"note":"Default export is a function; ESM-only since v5. CommonJS require returns undefined.","wrong":"const { fetch } = require('cordova-fetch')","symbol":"fetch","correct":"import fetch from 'cordova-fetch'"},{"note":"In CommonJS, use .default to get the function. Direct require gives an object without fetch.","wrong":"const fetch = require('cordova-fetch')","symbol":"fetch (function)","correct":"const fetch = require('cordova-fetch').default"},{"note":"getInfo is a named export, not default. Use curly braces.","wrong":"import getInfo from 'cordova-fetch'","symbol":"getInfo","correct":"import { getInfo } from 'cordova-fetch'"}],"quickstart":{"code":"import fetch from 'cordova-fetch';\nimport path from 'path';\n\nconst destDir = path.resolve('./my-plugin');\nconst plugin = '@cordova-plugin/example@^1.0.0';\n\nasync function fetchPlugin() {\n  try {\n    const result = await fetch(plugin, destDir);\n    console.log('Fetched plugin to:', result.path);\n  } catch (err) {\n    console.error('Fetch failed:', err.message);\n  }\n}\n\nfetchPlugin();","lang":"typescript","description":"Shows how to fetch a Cordova plugin from npm (specified as package@version) into a local directory using the default export."},"warnings":[{"fix":"Use import fetch from 'cordova-fetch' or const fetch = require('cordova-fetch').default.","message":"v5 drops CommonJS main export; require() returns an object without the fetch function.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Upgrade Node.js to >=20.9.0 and npm to >=8.1.0.","message":"Node.js 20+ and npm 8+ required; older versions not supported.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use https:// git URLs instead of git:// or ssh://.","message":"Git-based fetching via git:// or ssh:// URLs may be deprecated in future versions in favor of HTTPS.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Run npm login before fetching private packages.","message":"When fetching from npm, the package must be accessible in the npm registry; private packages require authentication (npm login).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure 'source' is a local directory when using --link.","message":"Fetching a plugin with --link option fails if the source is not a local path.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'2024':29 '5.0.0':22 'altern':44 'apach':1,58 'cadenc':26 'cli':5 'clone':51 'cordova':2,9,34,53,56,60,61 'current':19 'develop':54 'differenti':31 'ecosystem':59 'fetch':3,8,57 'git':14,42,50 'instal':48 'integr':32 'javascript':55 'key':30 'last':27 'logic':38 'low':24 'manual':46 'npm':17,47 'platform':12 'plugin':10 'plugin/platform':36 'refer':43 'registri':18 'releas':25 'repositori':15 'resolut':37 'semver':40 'support':39 'tool':6,62 'updat':28 'version':21","created_at":"2026-06-07T16:50:54.069831+00:00","updated_at":"2026-06-07T16:50:54.069831+00:00","problems":[{"fix":"Use const fetch = require('cordova-fetch').default;","cause":"CommonJS require returns an object with no fetch property in v5.","error":"TypeError: require(...).fetch is not a function"},{"fix":"Use format like '@scope/plugin@version' or 'git+https://url.git'.","cause":"Unsupported package specifier format (e.g., missing @scope/package).","error":"Error: fetch() got a spec that is not supported yet"},{"fix":"Check internet connection, proxy settings, and registry URL.","cause":"Network connectivity issue or registry unreachable.","error":"FetchError: request to https://registry.npmjs.org/... failed, reason: connect ECONNREFUSED"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/apache/cordova-fetch#readme","github":"https://github.com/apache/cordova-fetch","docs":null,"changelog":null,"pypi":null,"npm":"cordova-fetch","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}