2

I'm in the directory /backbone/ which has a main.js file within scripts. I run python -m SimpleHTTPServer from the backbone directory and display it in the browser and the console reads the error $ is not defined and references a completely different main.js file from something I was working on days ago with a local python server.

I am new to this and don't have an idea what's going on. Would love some suggestions if you have time.

Tom Zych
  • 13,329
  • 9
  • 36
  • 53
natecraft1
  • 2,737
  • 9
  • 36
  • 56

2 Answers2

2

I recently had this problem and it was due to the old page being stored in the browser cache. Accessing the port from a different browser worked for me (or you can clear your cache).

Jgible
  • 55
  • 7
  • 1
    You can also use ctrl+shift+R to refresh the page and bypass the cache. I was just having this problem now and your comment helped me figure out it is the browser cache so thank you! – Anna Aug 22 '22 at 22:38
1

Only one process can listen on a port; you cannot have two SimpleHTTPServer processes listening on the same port. You can however leave an old server process up and then disregard failed startup of the new server process or error message about automatic port conflict resolution.

To debug this process, use netstat ( lsof in OSX, since BSD netstat is lame ) to find the process listening on the port and then 'ps -fww' to list data about that process. You can also take a look at /proc/$pid ( linux ) to get a process ID's current working directories. lsof can also help track down files the process has open in linux OR BSD/OSX if you're unsure which files it's serving.

Hope it helps!

erik258
  • 14,701
  • 2
  • 25
  • 31
  • Hey Dan, I did netstat and it listed a ton of stuff. I couldn't find an '8000' which is the port I'm running at but it wouldn't let me scroll up all the way. 'pw -fww' listed 2 pid's, neither of which were 8000. is there a way to kill all processes on that specific port or what should i do? – natecraft1 Mar 20 '14 at 02:16
  • `grep` friend, `grep`. One ought never have to scan the output of any program with ones _eyes_ (ugh, yuck). If you're on linux try `sudo netstat -lptn | grep 8000`. – erik258 Mar 20 '14 at 02:18
  • that gave me nothing :/ I pushed the whole thing up to github if you think the problem might be in the files but I don't think so. Any other ideas? https://github.com/natecraft1/backbone-widget – natecraft1 Mar 20 '14 at 02:24
  • What URL are you hitting in the browser? – erik258 Mar 20 '14 at 02:30
  • ok, well then _something_ has to be listening on 8000. Are you running on mac? Try `lsof -n 4TCP:8000 | grep -i listen` – erik258 Mar 20 '14 at 02:45
  • I'm on ubuntu.. sorry i didn't mention that. Dan thanks so much for the help even if this doesn't work – natecraft1 Mar 20 '14 at 02:52