Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's not working on my sublime text #2

Closed
kxng0109 opened this issue Jun 5, 2021 · 17 comments
Closed

It's not working on my sublime text #2

kxng0109 opened this issue Jun 5, 2021 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@kxng0109
Copy link

kxng0109 commented Jun 5, 2021

I have live server installed on sublime text 3 and also node.js, npm and live server installed globally on my pc. But live server doesn't start and in the console it writes "FileNotFoundError: [WinError 2] The system cannot find the file specified". I don't know what I'm doing wrong, could anyone please help me? Below is the complete code in console.

Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 1088, in run_
return self.run(edit)
File "C:\Users\Other Users\AppData\Roaming\Sublime Text 3\Installed Packages\LiveServer.sublime-package\plugin.py", line 59, in run
File "./python3.3/subprocess.py", line 819, in init
File "./python3.3/subprocess.py", line 1110, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified

@molnarmark
Copy link
Owner

Did you set the global_node_modules_path and the node_executable_path settings?

@kxng0109
Copy link
Author

kxng0109 commented Jun 6, 2021

I left it as it's default settings. What am I meant to change it to?

@molnarmark molnarmark self-assigned this Jun 6, 2021
@molnarmark
Copy link
Owner

There is a section in the readme for this: https://github.com/molnarmark/sublime-live-server#node_executable_path

@kxng0109
Copy link
Author

kxng0109 commented Jun 6, 2021

Thanks. It's just showing 'localhost refused to connect'. Any reason why? And also is this a right pathing
node_executable_path": "C:/Program Files (x86)/nodejs/node.exe",

@molnarmark
Copy link
Owner

Yes, that looks right for Windows.
Sounds like a permission issue maybe? Try running Sublime with administrator privileges.

@kxng0109
Copy link
Author

kxng0109 commented Jun 9, 2021

Still didn't work.

@molnarmark
Copy link
Owner

I was able to reproduce the issue, I'm gonna look into it shortly.

@molnarmark molnarmark added the bug Something isn't working label Jun 10, 2021
@molnarmark
Copy link
Owner

I've pushed a quick fix here, please replace the contents of plugin.py with that (easiest to do with PackageResourceViewer

Also, you can safely set the node_executable_path setting to simply node.exe

Let me know if this is fixed for you, if so, I'll test it tomorrow on Linux and push out a new release.

@kxng0109
Copy link
Author

After doing everything you mention in your reply above and restarting sublime text, it wasn't loading it kept on showing a directory of my folder. When I clicked on the one I wanted, it kept try to load but it didn't but when I closed sublime text, it started working. I'm trying find out what it was but I can't because I've tried everything and it still works. Thank you.

@bhagwanZaki
Copy link

bhagwanZaki commented Jun 19, 2021

I did everything as written in Readme.MD but the live server is launching the browser but localhost is not working
OS: Windows 10

@kxng0109
Copy link
Author

I've been getting similar issues here, but I found out that restarting sublime text while localhost tries to load in your browser, will make it work.

@bhagwanZaki
Copy link

I did that too no progress

@molnarmark
Copy link
Owner

Are you trying to start live server with a sublime project opened inside sublime text? (Project > Save Project As)

@molnarmark molnarmark reopened this Jun 19, 2021
@HansAnonymous
Copy link
Contributor

Here's the fix for those of you who are having this issue:

"node_executable_path":

  1. Make sure Node.js is installed
  2. The executable node.exe is in the PATH environment variables. If not, add it.
  3. In the Live Server Settings, set "node_executable_path": "node.exe".
  4. If not set in PATH environment variables, add the direct path to the file such as: "node_executable_path": "C:/Program Files/nodejs/node.exe" (Default location).

"global_node_modules_path":

  1. Make sure live-server is globally installed: npm i -g live-server
  2. The node_modules path is set properly (default location, change user to yours): "global_node_modules_path": "C:/Users/YOURUSER/AppData/Roaming/npm/node_modules"

Hint: Make sure your directories exist, you can navigate to the ones pasted above to make sure they exist. The "global_node_modules_path" should be to the folder containing "live-server".

Additionally, previously addressed above with the sublime project, I have submitted a Pull Request to allow live-server to be started with the open file's directory in mind. That means no more needing to "Open Folder" or "Save Project As".

@molnarmark molnarmark pinned this issue Sep 16, 2021
@fanifrancs
Copy link

Please where do I find the live server settings on sublime text?

@molnarmark
Copy link
Owner

@fanifrancs To change your settings, bring up the Command Palette and select: Preferences: Live Server Settings

@kxng0109
Copy link
Author

kxng0109 commented Sep 2, 2022

@fanifrancs by the way, to open Command Palette, use Ctrl + shift + p on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants