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

问题描述 投票:0回答:1

自从我更新到 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使用我们自己的框架

谢谢

ios cordova plugins
1个回答
0
投票

如果将文件

node_modules\cordova\bin\cordova
的第 32 行替换为:

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

就我而言,更改后的错误是:

not found: emulator

© www.soinside.com 2019 - 2024. All rights reserved.