记一次cordova plugman 自定义安装插件错误CordovaError: Could not determine package name from output:

CordovaError: Could not determine package name from output:
这个错误网上有解决方案(如),但无论怎么改都是报下面错误。(明明以前很顺利的啊)

CordovaError: Could not determine package name from output:
added 1 package, and changed 1 package in 812ms
    at getTargetPackageSpecFromNpmInstallOutput (C:\Users\Administrator\AppData\Local\Yarn\Data\global\node_modules\cordova-fetch\index.js:91:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  jse_shortmsg: 'Could not determine package name from output:\n' +
    'added 1 package, and changed 1 package in 812ms',
  jse_info: {}
}

困扰了两个晚上,已经死马当活马医了。
打开JS文件看看代码.C:\Users\Administrator\AppData\Local\Yarn\Data\global\node_modules\cordova-fetch\index.js

function getTargetPackageSpecFromNpmInstallOutput (npmInstallOutput) {
    const packageInfoLine = npmInstallOutput.split('\n')
        .find(line => line.startsWith('+ '));
    if (!packageInfoLine) {
        throw new CordovaError(`Could not determine package name from output:\n${npmInstallOutput}`);
    }
    return packageInfoLine.slice(2);
}

npmInstallOutput 是空字符串。百度了一下npmInstallOutput 是什么 cordova-fetch是什么。

This package can be used to install and uninstall Node.js packages using npm.

记得 cordova 是用npm install -g cordova 装的。难道和这个有关?

用yarn global add cordova 重新装了一次。

plugin add E:\ywd\maoku\custom-plugin-math
(node:13692) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\Users\Administrator\AppData\Local\Yarn\Data\global\node_modules\objectorarray\package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
Installing "custom-plugin-math" for android
Adding custom-plugin-math to package.json

啊·居然成功了,虚度了两个夜晚。码农就不深究了,继续业务搬砖。

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容