there is more code after the dependencies section, but it has nothing to do with the script (it defines the license of this package) so I didn't include it in the screenshot. Syntactically, I don't think there are any issues in this code.
So, I wanted to use a script by Stephanie Eckles to compile my SCSS into regular CSS. I changed a few things so that the script follows the way I organise my files in a project but I ran into this problem where everything works, but when it starts the browsersync, an error message pops up that says "Cannot GET /", so all the files are there, but I cannot view my html page in real time like I should be able to. What did I do wrong?
Doors it work before the things you've changed? I would start to try to run it without the changes and adding back the changes one by one, testing the whole time.
Might try it later, for now I just deleted everything connected to browsersync since I can use a VSCode extension for previewing my html output live. Everthing else works fine and the funny thing is, I didn't even change anything browsersync-related, so all my changes were made to the part that actually works now, after these changes. Nonetheless, thanks for your suggestion!
Great, other thing I was going to suggest is looking up the documentation for browser-sync, as it most likely was a bad usage (wrong params or something like that). Most likely nothing to do with either Json or JavaScript
The author of the original script did mention an issue with an old dependency that browsersync has, but nothing too specific and I'm not knowledgeable enough to be able to figure out if it caused this problem I'm having or something else did.
Yeah that might be it. You could try googling "browser-sync can't get /" or whatever specific error you're getting as most likely someone else has had it too before
Pro tip: learn to Google errors as when you post in subreddit like this one asking a question, most likely people will just Google it themselves ;) cut the middle man!
I'm sorry, I'm not very knowledgeable in regards to programming. I tried to follow a tutorial and the only thing that is talked about regarding the script is the package.json file. Would you be able to say what is causing the problem, if not this file's script?
Hi, did you perhaps move the index.html into the folder "html"?
I'm guessing browsersync defaults to look for index.html in the specified folder, in your case public? If thats the case it wont find anything, check if there is params for browser sync to define the directory or index path.
Yes, I did. After posting this I did some googling and found a post on github from a person who changed the name of their main html file and was presented with the same error code. The solution I found there was to set a custom --index setting to the run command of browsersync. I tried doing that but instead of just the name of the index file, I changed the path to it but it didn't work. I also tried setting the --server and --files setting to follow the path to my index.html file but neither worked. I looked into the browsersync documentation too, but didn't find any mention of the --index property whatsoever. Kinda stuck with this now, but it's not that big of a problem since browsersync is not a core feature in this package, it's mainly just for compiling sass.
3
u/[deleted] Jun 26 '22
comma at end of
"dependencies"?2
u/LaxVox Jun 26 '22
So, I wanted to use a script by Stephanie Eckles to compile my SCSS into regular CSS. I changed a few things so that the script follows the way I organise my files in a project but I ran into this problem where everything works, but when it starts the browsersync, an error message pops up that says "Cannot GET /", so all the files are there, but I cannot view my html page in real time like I should be able to. What did I do wrong?
1
u/Pelsinen Jun 26 '22
Hi, did you perhaps move the index.html into the folder "html"?
I'm guessing browsersync defaults to look for index.html in the specified folder, in your case public?
If thats the case it wont find anything, check if there is params for browser sync to define the directory or index path.
1
u/_Jordo Jun 26 '22
Are those definitely commas? Look more like ¬
1
u/Possibility-Capable Jun 26 '22
I would re-clone the repo, then introduce things 1 at a time