试图为Android构buildapk并获取npm错误

嗨,当我尝试运行此命令ionic cordova build android --release我得到下面的错误

我试过了什么

  • 我重新安装离子,cordova仍然没有工作
  • 我重新安装了nodeJS
  • 我也卸载了Android平台,并重新安装它,它仍然没有工作。
  • 我尝试安装cordova-plugin-email-composer
  • 我也尝试了不同的程序,如git bash,PowerShell和命令提示符

     (truncated) ... ww/js/services.js File www/js/services.js has no errors. ----------------------------------------- Linting www/js/views.js File www/js/views.js has no errors. ----------------------------------------- Discovered plugin "com.rjfun.cordova.iad" in config.xml. Adding it to the project Failed to restore plugin "com.rjfun.cordova.iad" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin com.rjfun.cordova.iad@^2.0.4 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 ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "com.rjfun.cordova.iad@2.0.4" npm ERR! node v6.11.2 npm ERR! npm v3.10.10 npm ERR! code E404 npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/com.rjfun.cordova.iad npm ERR! 404 npm ERR! 404 'com.rjfun.cordova.iad' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! Please include the following file with any support request: npm ERR! C:\Users\fartsstinksodontfart\Desktop\newiconic\hoydesigndiifferent\node_modules\npm-debug.log Discovered plugin "cordova-plugin-email-composer" in config.xml. Adding it to the project Failed to restore plugin "cordova-plugin-email-composer" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin cordova-plugin-email-composer@https://github.com/katzer/cordova-plugin-email-composer.git#0.8.2 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 ERR! git clone C:\Users\fartsstinksodontfart\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-katzer-cordova-plugin- email-composer-git-0-8-2-1181afa8 C:\Users\FARTSS~1\AppData\Local\Temp\npm-10508-f9448953\git-cache-5f8d071e\cab303daada1d86579b6c76354b8333ae5d1a efe: Cloning into 'C:\Users\FARTSS~1\AppData\Local\Temp\npm-10508-f9448953\git-cache-5f8d071e\cab303daada1d86579b6c76354b8333ae5d1 aefe'... npm ERR! git clone C:\Users\fartsstinksodontfart\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-katzer-cordova-plugin- email-composer-git-0-8-2-1181afa8 C:\Users\FARTSS~1\AppData\Local\Temp\npm-10508-f9448953\git-cache-5f8d071e\cab303daada1d86579b6c76354b8333ae5d1a efe: error: cannot spawn sh: No such file or directory npm ERR! git clone C:\Users\fartsstinksodontfart\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-katzer-cordova-plugin- email-composer-git-0-8-2-1181afa8 C:\Users\FARTSS~1\AppData\Local\Temp\npm-10508-f9448953\git-cache-5f8d071e\cab303daada1d86579b6c76354b8333ae5d1a efe: fatal: unable to fork npm ERR! git clone C:\Users\fartsstinksodontfart\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-katzer-cordova-plugin- email-composer-git-0-8-2-1181afa8 C:\Users\FARTSS~1\AppData\Local\Temp\npm-10508-f9448953\git-cache-5f8d071e\cab303daada1d86579b6c76354b8333ae5d1a efe: npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "cordova-plugin-email-composer@https://github.com/katzer/cordova-plugin-email-composer.git#0.8.2" npm ERR! node v6.11.2 npm ERR! npm v3.10.10 npm ERR! code 128 npm ERR! Command failed: git -c core.longpaths=true clone C:\Users\fartsstinksodontfart\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-katzer-cordova-plugin- email-composer-git-0-8-2-1181afa8 C:\Users\FARTSS~1\AppData\Local\Temp\npm-10508-f9448953\git-cache-5f8d071e\cab303daada1d86579b6c76354b8333ae5d1a efe npm ERR! Cloning into 'C:\Users\FARTSS~1\AppData\Local\Temp\npm-10508-f9448953\git-cache-5f8d071e\cab303daada1d86579b6c76354b8333ae5d1 aefe'... npm ERR! error: cannot spawn sh: No such file or directory npm ERR! fatal: unable to fork npm ERR! npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! <https://github.com/npm/npm/issues> npm ERR! Please include the following file with any support request: npm ERR! C:\Users\fartsstinksodontfart\Desktop\newiconic\hoydesigndiifferent\node_modules\npm-debug.log Running command: "C:\Program Files\nodejs\node.exe" C:\Users\fartsstinksodontfart\Desktop\newiconic\hoydesigndiifferent\hooks\after_prepare\010_add_platform_class.js C:\Users\fartsstinksodontfart\Desktop\newiconic\hoydesigndiifferent add to body class: platform-android Running command: "C:\Program Files\nodejs\node.exe" C:\Users\fartsstinksodontfart\Desktop\newiconic\hoydesigndiifferent\hooks\after_prepare\020_remove_sass_from_pla tforms.js C:\Users\fartsstinksodontfart\Desktop\newiconic\hoydesigndiifferent 

你可能只有在你的config.xml有这个插件。 使用CLI删除和添加插件应该可以解决这个问题。它会自动将其添加到plugins/fetch.json文件中。

 cordova plugin rm com.rjfun.cordova.iad cordova plugin add com.rjfun.cordova.iad 

如果这不工作。删除node_modules目录,然后npm install