Shopify / themekit

Shopify theme development command line tool.
https://shopify.dev/tools/theme-kit
MIT License
1.19k stars 374 forks source link

Templates directory is trying to be located in a doubled-up absolute path #885

Closed smjeffries-snap closed 3 years ago

smjeffries-snap commented 3 years ago

Describe the bug AKA it's trying to process the absolute path of templates while inside the project directory. It's happening while theme watch runs and I'm making changes to a template liquid file.

image

andyw8 commented 3 years ago

@smjeffries-snap please provide the information that the issue template asks for, otherwise it's very hard to help you.

andershagbard commented 3 years ago

I am experiencing the same issue after update to 1.1.5.

tanema commented 3 years ago

What about steps to reproduce, For instance, a lot of behaviour was recently added around what happens when folders are added or removed from a project while watch is running. Is that something that is happening. Please be detailed. For example.

  1. run theme watch
  2. change file
  3. File processes normally
  4. do another action
  5. file no longer normal.

We cannot do much with so little information

andershagbard commented 3 years ago

I've just reproduced this error. I am now sure if this has something to do, with me using directory option in the config file.

  1. Run theme watch
  2. Change a file within the sections folder

Everything will update just fine, but it will throw this annoying error.

smjeffries-snap commented 3 years ago

Describe the bug AKA it's trying to process the absolute path of templates while inside the project directory. It's happening while theme watch runs and I'm making changes to a template liquid file.

To Reproduce Make a change to a templates/*.liquid file while theme watch is running

Expected behavior To not even try processing the whole templates directory absolute path

Environment

Additional There is nothing specific I have done to reproduce this error. It just started happening after I updated to 1.1.5 and started making changes to template liquid files

jasewarner commented 3 years ago

Experiencing the exact same problem as @smjeffries-snap since updating to 1.1.5.

Well, I say “exact”, but I encountered the issue several times when making changes to files in the sections directory.

tanema commented 3 years ago

I see the the error is from a directory, is this true for all of the errors you get? Are all of the errors from a path to a directory, or filenames as well.

tanema commented 3 years ago

Also I see two people saying they are using PhpStorm in here, is that true for all of you?

jasewarner commented 3 years ago

All the errors I’m getting are for the sections folder.

And yes, I am also using PhpStorm.

tanema commented 3 years ago

Okay, can confirm that this happens with PhpStorm, ~and for some reason the issue is fixed when I log the file events.~ I am not sure yet what is causing it but I am looking

verdant-spark commented 3 years ago

Okay, can confirm that this happens with PhpStorm, and for some reason the issue is fixed when I log the file events. I am not sure yet what is causing it but I am looking

Also using phpStorm - came here to report the same issue. Only since last update. My error messages show as: [development] error loading \snippets: readAsset: open \\snippets: The filename , directory name, or volume label syntax is incorrect.

Full path concatenated to full path again, joined with a backslash.

I have multiple theme installations for multiple clients, and the same behaviour is present for all. Anything else you need from me to help debug this just shout.

tanema commented 3 years ago

I have figured out this issue and should have a fix out soon https://github.com/Shopify/themekit/pull/889 As previously noted, this error is just noise, it is not preventing any of the file processing or causing any issues, themekit is just simply generating nonsense events in some instances that cannot be actioned.

ckizer commented 3 years ago

Also I see two people saying they are using PhpStorm in here, is that true for all of you?

Nope I'm not using PHPStorm. Just using Shopify Themekit and GitHub repository. with OS X 11.1, and 11.2 (beta). As soon as I upgraded both my Macs to the latest version of ThemeKit as the command line suggested this error happens.

I'm wondering if this has something to do with OS X Permissions? Do we need to grant theme command line tool access via System Preferences > Security Permissions?

If I use 1 version older of themekit all the errors go away. Seems to be something specifically with the new version. Let me know if there's anything I can document to help better debug the error.

CleanShot 2021-01-27 at 10 13 32@2x
ckizer commented 3 years ago

What's the command to downgrade to the last previous version? 1.1.4? One of my development machines that I didn't upgrade still has the old version, but I'm not quite sure how to downgrade all the ones on 1.1.5.

I figure I can revert/downgrade to the older version and if there's no further errors, I'll know for sure it was something with 1.1.5

andyw8 commented 3 years ago

To downgrade: theme update --version 1.1.4

ckizer commented 3 years ago

To downgrade: theme update --version 1.1.4

Thank you! No more errors. I did some informal testing on:

Mac #1 (v1.1.5) Edit theme.liquid adding in "hello world" readAsset: open /Users/ck/Documents/repos/OruKayak/Users/ck/Documents/repos/OruKayak/layout: no such file or directory

Mac #2 (Downgraded v1.1.4) Edit theme.liquid adding in "hello world" Updated Successfully

Mac #1 reverting to v.1.14 No further errors

tanema commented 3 years ago

As said before, these errors are just output. Nothing is changing about behaviour but you are getting a more optimized file watcher. This issue is not specifically about PhpStorm, but rather just file events that certain editors spawn by touching the mod time of the parent folder directly after editing a file.

There is no real reason to downgrade.

ckizer commented 3 years ago

As said before, these errors are just output. Nothing is changing about behaviour but you are getting a more optimized file watcher. This issue is not specifically about PhpStorm, but rather just file events that certain editors spawn by touching the mod time of the parent folder directly after editing a file.

There is no real reason to downgrade.

Unfortunately v1.1.5 isn't pushing the file to Shopify's servers when it gets the readAsset error for me. I thought it was. The only way to get it working was to downgrade.

If 1.1.5 readAsset error is just a notification I think we should change the text color, and the warning to let people know that it's okay. It's alarming, and confusing, and makes the user think their installation of themekit is broken.

I'm all for more verbose logging, but this one tripped most of our seasoned pro development team up.

ressy commented 3 years ago

For what it's worth, the behavior I see with 1.1.5 matches what @tanema describes and what some of the earlier screenshots show: the errors about the directory path are separate from the log messages about (successfully) updated files, and just depend on modification time of the directories it's complaining about. The directories can even be slightly older than the files that triggered the check and not even related to those files:

touch -m templates && sleep 0.3 && touch layout/theme.liquid

It's just that they get caught up in the update process because of the modification time.

19:11:32 [development] processing layout/theme.liquid
19:11:32 [development] Skipped layout/theme.liquid (Checksum: fd2d37bbc282af23d860c0f886eec0b1)
19:11:32 [development] processing /home/jesse/dev/web/rennes-theme/templates
[development] error loading /home/jesse/dev/web/rennes-theme/templates: readAsset: open /home/jesse/dev/web/rennes-theme/home/jesse/dev/web/rennes-theme/templates: no such file or directory

I think that's what @tanema meant about it being "just noise" because files process like usual and it's just processing directories that fails (which doesn't matter anyway since they're directories). I haven't been able to reproduce any trouble with pushing files in my install of 1.1.5.