Электронный выброс TypeError: URL-адрес должен быть строкой. Получено undefined - PullRequest
0 голосов
/ 06 августа 2020

Я использую electron и vue.js для разработки приложения, которое может управлять сервером webdav, но я обнаружил ошибку и не знаю, как она появляется.

Вот сообщение об ошибке.

vue.runtime.esm.js?2b0e:1888 TypeError: Url must be a string. Received undefined
    at t (index.js?0cb4:1)
    at eval (index.js?0cb4:1)
    at joinURL (index.js?0cb4:1)
    at Object.putFileContents (index.js?0cb4:9)
    at Object.putFileContents (index.js?0cb4:2)
    at uploadFile (file.js?bdf0:99)
    at eval (AppLayout.vue?f35d:362)
    at Array.forEach (<anonymous>)
    at VueComponent.handleUploadClick (AppLayout.vue?f35d:349)
    at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
    at VueComponent.invoker (vue.runtime.esm.js?2b0e:2179)
    at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
    at VueComponent.Vue.$emit (vue.runtime.esm.js?2b0e:3888)
    at VueComponent.click (VBtn.ts?0eff:156)
    at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
    at HTMLButtonElement.invoker (vue.runtime.esm.js?2b0e:2179)

И мой код выглядит как поток:

export const uploadFile = (client, localPath, remotePath) => {
  let data = fs.readFileSync(localPath);
  return client.putFileContents(
    remotePath + "/" + path.basename(localPath),
    data
  );
};
...