We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm trying to (in a very rudimentary way) port a project from Unix to Windows and receiving errors. (Both using the same ide, Sublime) The app runs fine on my Unix environment but not Windows with the same code.
:((
TypeError
"cannot read property 'prototype' of undefined"
at setup (sketch.js:8)
at p5. (p5.js:44882)
at p5. (p5.js:44810)
at new p5 (p5.js:45103)
at _globalInit (p5.js:46862)
:((
ReferenceError
"createSlider is not defined"
at p5.dom.js:71
at p5.dom.js:34
at p5.dom.js:35
I'm using the exact code from Shiffman's YouTube walkthrough: Coding Challenge #14: Fractal Trees - Recursive.
Is there a caveat to working on Windows ?
Updates :
I tried using my XAMPP server too. It still doesn't work.
I might have to try the WAMP server.
Also, I uploaded the page to my BlueHost site to no avail. I received the exact same errors.
I've used both CDN and downloaded files for p5.dom.js and p5.js
Answers
Additionally : Using p5.js/0.5.16 and Windows 7 (Like a pr0)
Can you post an MCVE? Alternatively, you can host your code online. For example,
http://p5js.sketchpad.cc
https://thimble.mozilla.org/en-US/
https://OpenProcessing.org/sketch/create or
GitHub's gh-pages: https://help.GitHub.com/articles/configuring-a-publishing-source-for-github-pages/
Kf
@kfrajer thanks for the response, I really appreciate it.
This is the HTML
https://raw.githubusercontent.com/YoshiDesign/P5_JS/master/index.html
And the JavaScript
https://raw.githubusercontent.com/YoshiDesign/P5_JS/master/sketch.js
I'm completely new to P5JS and I'm sorry if I'm wasting your time on a very simple topic. Clearly I'm missing some vital information!
Just saved your "index.html" & "sketch.js" in a folder and I was able to open the ".html" file under my 64-bit Win 8.1 laptop here perfectly, w/o any modification to those 2 files whatsoever! :)>-
Notice though only Firefox-based browsers can run ".js" scripts under
file://
protocol scheme. L-)For Chrome-based browsers, look at here: http://Chrome-allow-file-access-from-file.com/ *-:)
For more surefire (albeit more complex) solutions for all browsers, read this following wiki: :-B
https://GitHub.com/processing/p5.js/wiki/Local-server
What browser are you using? Are all script files definitely loading correctly? Are you doing any transpilation (e.g. Babel) on your source code? Could Unix line endings be an issue?
It's quite a strange error message.. :/
If you still have the project on Bluehost give us a link: maybe the issue is local to your machine. E.g. anti virus blocking cdn source?
Opening with the latest Chrome and Firefox on Windows 7 --> Errors
Using XAMPP loopback on Windows 7 --> Errors
Opening with Firefox on Unix (Ubuntu 16.04) --> Success
What's more disconcerting is that it wont run from my (Broken :) ) Bluehost website on either OS. www.alyrist.com/pages/intro2.html @blindfish
I'll test it on a Flask server when I wake up, because if that works I could care less about compatibility anywhere else.
But still I'll dig deeper. I do appreciate the links @GoToLoop
The "intro2.html" file from your link http://ALyrist.com/pages/intro2.html is loading "p5.js" & "p5.dom.js" remote library files in the wrong order:
view-source:http://ALyrist.com/pages/intro2.html
:-O"p5.dom.js" addon library depends on "p5.js" to be already loaded in order to annex itself to the latter's p5 & p5.Element API classes. L-)
Here's a minimum template sample to load the most recent "p5.min.js" & "p5.dom.min.js" CDN remote library files in the right order, plus our own "sketch.js" code from the local/server root folder: :-bd
And below's some online-hosted sketch link using exactly the "index.html" above: B-)
http://Bl.ocks.org/GoSubRoutine/7a567f0510b338b6d0fc1ef53f24f10e
I don't see why those 2 files from your repo https://GitHub.com/YoshiDesign/P5_JS/ would fail to run on any OS! @-)
As I've stated from my previous 1st answer post, they've worked in my 64-bit Win 8.1 for all browsers I've tested them. \m/
Of course any browsers, apart from Firefox-based 1s, have their own way to enable the
file://
protocol scheme though. :\">You should check whether some antivirus would be blocking your JS scripts from loading/running under your Win7 there. I can't envision anything else. :-@
My scripts were in the wrong order :) SOLVED!
Ugh...I knew it was something silly.
I'll leave this post up for the archive, thank you gentlemen.
Also it helps to stick to folder naming conventions when working with your hosting service :P