Cordova插件安装,“path”参数必须是字符串类型,接收未定义

vngu2lb8  于 2023-10-24  发布在  其他
关注(0)|答案(1)|浏览(303)

自从我更新到Cordova Cli 12和Cordova IOS 7,我在尝试添加我们的自定义插件时遇到了这个错误。

cordova plugins add ../../cordova-custom-plugins/DIMScanner/DimScannerCordovaPlugin/

我不知道这条信息是什么意思,欢迎任何帮助。

Plugin "cordova-plugin-dimscanner" already installed on android.
Installing "cordova-plugin-dimscanner" for ios
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-dimscanner': TypeError [ERR_INVALID_ARG_TYPE]: Uh oh!
The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:399:5)
    at validateString (node:internal/validators:163:11)
    at Object.basename (node:path:1313:5)
    at new pbxFile (/Users/patrick/VMSharedFolder/Projects/newgesmobile/gesmobile/src-cordova/node_modules/xcode/lib/pbxFile.js:189:26)
    at pbxProject.addBuildPhase (/Users/patrick/VMSharedFolder/Projects/newgesmobile/gesmobile/src-cordova/node_modules/xcode/lib/pbxProject.js:921:26)
    at install (/Users/patrick/VMSharedFolder/Projects/newgesmobile/gesmobile/src-cordova/node_modules/cordova-ios/lib/plugman/pluginHandlers.js:124:31)
    at ActionStack.process (/Users/patrick/VMSharedFolder/Projects/newgesmobile/gesmobile/src-cordova/node_modules/cordova-ios/node_modules/cordova-common/src/ActionStack.js:55:25)
    at PluginManager.doOperation (/Users/patrick/VMSharedFolder/Projects/newgesmobile/gesmobile/src-cordova/node_modules/cordova-ios/node_modules/cordova-common/src/PluginManager.js:111:24)
    at PluginManager.addPlugin (/Users/patrick/VMSharedFolder/Projects/newgesmobile/gesmobile/src-cordova/node_modules/cordova-ios/node_modules/cordova-common/src/PluginManager.js:141:21)
    at Api.addPlugin (/Users/patrick/VMSharedFolder/Projects/newgesmobile/gesmobile/src-cordova/node_modules/cordova-ios/lib/Api.js:258:14)
TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('ERR_INVALID_ARG_TYPE')
    at process.set [as exitCode] (node:internal/bootstrap/node:124:9)
    at /usr/local/lib/node_modules/cordova/bin/cordova:32:22

该插件使用以下plugin.xml文件

<plugin id="cordova-plugin-dimscanner" version="1.0.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>DIMScanner</name>
<js-module name="DIMScanner" src="www/DIMScanner.js">
    <clobbers target="cordova.plugins.DIMScanner" />
</js-module>
<platform name="ios">
    <config-file parent="/*" target="config.xml">
        <feature name="DIMScanner">
            <param name="ios-package" value="DIMScanner" />
        </feature>
    </config-file>
     <preference name="CAMERA_USAGE_DESCRIPTION" default="This app needs camera access"/>
        <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
            <string>$CAMERA_USAGE_DESCRIPTION</string>
         </config-file>
     <preference name="PHOTO_LIBRARY_USAGE_DESCRIPTION" default="This app needs to access photo library"/>
    <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
        <string>$PHOTO_LIBRARY_USAGE_DESCRIPTION</string>
     </config-file>
    <source-file src="src/ios/DIMScanner.swift" />
    <framework src="src/ios/DimScannerFramework.framework" custom="true" embed="true"/>
      <podspec>
         <config>

         </config>
         <pods use-frameworks="true">
             <pod name="Alamofire" tag="5.0.0-rc.3" git="https://github.com/Alamofire/Alamofire.git" />
             <pod name="SnapKit"/>
             <pod name="PKHUD" tag="5.3.0" git="https://github.com/pkluz/PKHUD.git"/>
             <pod name="Firebase/MLVisionTextModel"/>
         </pods>
        </podspec>
</platform>

plugin.xml使用我们自己的框架
谢谢

rwqw0loc

rwqw0loc1#

如果将文件node_modules\cordova\bin\cordova的第32行替换为:

process.exitCode = typeof(err.code) === "number" ? err.code : 1;

在我的例子中,修改后的错误是:not found: emulator

相关问题