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
啊·居然成功了,虚度了两个夜晚。码农就不深究了,继续业务搬砖。