TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined



  • taro convert 转下面js文件失败

    /**
     * Created by rd on 2017/5/4.
     */
    
    var Crypto = require('./cryptojs-master/cryptojs.js').Crypto
    
    function RdWXBizDataCrypt(appId, sessionKey) {
      this.appId = appId
      this.sessionKey = sessionKey
    }
    
    RdWXBizDataCrypt.prototype.decryptData = function(encryptedData, iv) {
      // base64 decode :使用 CryptoJS 中 Crypto.util.base64ToBytes()进行 base64解码
      var encryptedData = Crypto.util.base64ToBytes(encryptedData)
      var key = Crypto.util.base64ToBytes(this.sessionKey)
      var iv = Crypto.util.base64ToBytes(iv)
    
      // 对称解密使用的算法为 AES-128-CBC,数据采用PKCS#7填充
      var mode = new Crypto.mode.CBC(Crypto.pad.pkcs7)
      var decryptResult = null
      try {
        // 解密
        var bytes = Crypto.AES.decrypt(encryptedData, key, {
          asBpytes: true,
          iv: iv,
          mode: mode
        })
    
        decryptResult = JSON.parse(bytes)
      } catch (err) {
        console.log(err)
      }
    
      if (decryptResult && decryptResult.watermark.appid != this.appId) {
        console.log(err)
      }
    
      return decryptResult
    }
    
    module.exports = {
      RdWXBizDataCrypt: RdWXBizDataCrypt
    }
    

    报错信息:

    拷贝  JS 文件   taroConvert/src/common/RdWXBizDataCrypt.js
    TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
        at validateString (internal/validators.js:117:11)
        at Object.extname (path.js:1229:5)
        at Object.analyzeImportUrl (/usr/local/lib/node_modules/@tarojs/cli/dist/convertor/helper.js:34:31)
        at CallExpression (/usr/local/lib/node_modules/@tarojs/cli/dist/convertor/index.js:162:46)
        at NodePath._call (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/path/context.js:76:18)
        at NodePath.call (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/path/context.js:48:17)
        at NodePath.visit (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/path/context.js:105:12)
        at TraversalContext.visitQueue (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/context.js:150:16)
        at TraversalContext.visitSingle (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/context.js:108:19)
        at TraversalContext.visit (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/context.js:192:19) {
      code: 'ERR_INVALID_ARG_TYPE'
    

登录后回复