typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 56 forks source link

Custom command upload fails #4898

Closed joeledwardson closed 2 years ago

joeledwardson commented 2 years ago

Describe the bug When using picgo as a custom command: "/home/joel/.nvm/versions/node/v17.2.0/bin/picgo" upload I get a Validation Failed error: /usr/bin/env: ‘node’: No such file or directory. (see screenshots at bottom)

I try copying this exact command into terminal and it works fine (I have tried with and without quotations on the picgo command)

$ "/home/joel/.nvm/versions/node/v17.2.0/bin/picgo" upload "/tmp/typora-icon2.png" "/tmp/typora-icon.png"
[PicGo INFO]: Before transform
[PicGo INFO]: Transforming... Current transformer is [path]
[PicGo INFO]: Before upload
[PicGo INFO]: Uploading... Current uploader is [smms]
[PicGo SUCCESS]: 
https://s2.loli.net/2021/12/06/bZTc8yYfdKvq2xe.png
https://s2.loli.net/2021/12/06/7vSCpfPkzscNFmy.png

Docs Within the export section of the docs, there is a section that looks like the same bug but this is a different section to the relevant upload image section.

Env: node: No such file or directory If you use custom command like node xxx, please make sure node is in your system PATH. Or you can specify the node command with its full path. You can find your node path by input which node or where node in your shell to locate the node bin location.

Screenshots / Screencasts Image Upload Setting image

Screenshot of error image

Desktop No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

Typora Version v1.0.3

abnerlee commented 2 years ago

Your terminal may use zsh, fish, etc with their own configs and environments. And if you use nvs, then there's no node into your system ENV, nvs use xxx may add it in current session.

So you should use ${nodePath} ${picgoPath} update to update image

joeledwardson commented 2 years ago

Hi @abnerlee, I'm using nvm, I updated the custom script to /home/joel/.nvm/versions/node/v16.13.1/bin/node /home/joel/.nvm/versions/node/v16.13.1/bin/picgo upload as you suggested and it works fine - thanks.

If the command option expects the first argument to be a node binary in the format you've described ${nodePath} ${picgoPath} update (and if not will try to find one), should this be added to the docs? I can't see anything in the docs that explains this

yaoyhu commented 2 years ago

I'm using nvm, I updated the custom script to /home/danielhu/.nvm/versions/node/v18.10.0/bin/node /home/danielhu/.nvm/versions/node/v18.10.0/bin/picgo u as you suggested above. And I can upload the pic from my clipboard (just 'u' as argument), but it doesn't work well in typora. Here is my screenshot: image I copied the command terminal like this: image

yaoyhu commented 2 years ago

I'm using nvm, I updated the custom script to /home/danielhu/.nvm/versions/node/v18.10.0/bin/node /home/danielhu/.nvm/versions/node/v18.10.0/bin/picgo u as you suggested above. And I can upload the pic from my clipboard (just 'u' as argument), but it doesn't work well in typora. Here is my screenshot: image I copied the command terminal like this: image

Already fixed it, it seems that the repository had the same file.