derbyjs / derby-examples

Example applications for the Derby framework
http://derbyjs.com/
283 stars 74 forks source link

Codemirror example balks on start-up #47

Closed codingisacopingstrategy closed 10 years ago

codingisacopingstrategy commented 10 years ago

Hello!

Cloned the repo, did an npm install, changed into the codemirror directory and ran node server.js.

The example balks in Chrome Canary with the following traceback:

Uncaught TypeError: Cannot read property 'replace' of undefined
showdown.js:62makeHtml
showdown.js:62SD.convert
index.js:28SD.create
index.js:23ComponentFactory.create
components.js:148PendingCreate.run
contexts.js:181Context.flush
contexts.js:168Context.unpause
contexts.js:159Page.attach
Page.js:105App._finishInit
App.js:82(anonymous function)
App.js:119
Unhandled document message: Object {racer: "derby:app", id: "1", data: Array[0], ack: 1, cb: 0…}ack: 1c: nullcb: 0d: nulldata: Array[0]id: "1"racer: "derby:app"__proto__: Object doc.js:388
TypeError: Cannot read property 'replace' of undefined {stack: (...), message: "Cannot read property 'replace' of undefined"}message: "Cannot read property 'replace' of undefined"stack: (...)get stack: function () { [native code] }set stack: function () { [native code] }__proto__: Error microevent.js:45MicroEvent.emit microevent.js:45socket.onmessage connection.js:126Channel.socket.onmessage Channel.js:19e bcsocket-uncompressed.js:2682g.channelHandleArray bcsocket-uncompressed.js:2720f.Rb bcsocket-uncompressed.js:2462nd bcsocket-uncompressed.js:1977md bcsocket-uncompressed.js:1858f.ec bcsocket-uncompressed.js:1833f.Bc bcsocket-uncompressed.js:1809yc bcsocket-uncompressed.js:1328f.dispatchEvent bcsocket-uncompressed.js:1298Rc bcsocket-uncompressed.js:1513f.uc bcsocket-uncompressed.js:1503f.Qb bcsocket-uncompressed.js:1500
TypeError: Cannot read property 'replace' of undefined
    at makeHtml (http://localhost:3000/showdown/showdown.js:62:1099)
    at Component.SD.convert (http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:130:29)
    at http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:123:10
    at Model.modelListener (http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:13067:8)
    at Model.EventEmitter.emit [as _emit] (http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:4866:20)
    at Model.emit (http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:12913:12)
    at Array.subscribeDocCallback (http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:15508:13)
    at Doc._finishSub (http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:17457:34)
    at Doc._handleSubscribe (http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:17199:10)
    at Connection.handleMessage (http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:16616:17) bcsocket-uncompressed.js:2684

in the latest Firefox the error message is:

TypeError: a is undefined showdown.js:62
"Unhandled document message:" Object { racer: "derby:app", id: "1", data: Array[0], ack: 1, cb: 0, c: null, d: null } codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:17318
TypeError: a is undefined
Stack trace:
Showdown.converter/this.makeHtml@http://localhost:3000/showdown/showdown.js:62:1074
require<[3]</</SD.prototype.convert@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:130:1
require<[3]</</SD.prototype.create/<@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:123:5
modelListener@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:13067:5
require<[15]</EventEmitter.prototype.emit@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:4866:7
require<[52]</Model.prototype.emit@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:12913:7
subscribeDocCallback@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:15508:7
require<[71]</Doc.prototype._finishSub@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:17457:7
require<[71]</Doc.prototype._handleSubscribe@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:17199:5
require<[70]</Connection.prototype.handleMessage@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:16616:13
require<[70]</Connection.prototype.bindToSocket/socket.onmessage@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:16546:7
Channel/socket.onmessage@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:11020:5
require<[5]</</$/e@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2828:29
require<[5]</</$/g.channelHandleArray@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2866:5
require<[5]</</f.Rb@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2608:11
nd@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2123:5
md@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2004:9
require<[5]</</f.ec@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1979:9
require<[5]</</f.Bc@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1955:3
yc@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1474:7
require<[5]</</f.dispatchEvent@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1444:3
Rc@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1659:1
require<[5]</</f.uc@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1649:3
require<[5]</</f.Qb@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1646:3
 codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:18013
"Showdown.converter/this.makeHtml@http://localhost:3000/showdown/showdown.js:62:1074
require<[3]</</SD.prototype.convert@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:130:1
require<[3]</</SD.prototype.create/<@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:123:5
modelListener@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:13067:5
require<[15]</EventEmitter.prototype.emit@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:4866:7
require<[52]</Model.prototype.emit@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:12913:7
subscribeDocCallback@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:15508:7
require<[71]</Doc.prototype._finishSub@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:17457:7
require<[71]</Doc.prototype._handleSubscribe@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:17199:5
require<[70]</Connection.prototype.handleMessage@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:16616:13
require<[70]</Connection.prototype.bindToSocket/socket.onmessage@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:16546:7
Channel/socket.onmessage@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:11020:5
require<[5]</</$/e@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2828:29
require<[5]</</$/g.channelHandleArray@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2866:5
require<[5]</</f.Rb@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2608:11
nd@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2123:5
md@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2004:9
require<[5]</</f.ec@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1979:9
require<[5]</</f.Bc@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1955:3
yc@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1474:7
require<[5]</</f.dispatchEvent@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1444:3
Rc@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1659:1
require<[5]</</f.uc@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1649:3
require<[5]</</f.Qb@http://localhost:3000/derby/codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:1646:3
" codemirror-6f572a2f0319d6c0c28c7f8ce972d0fa.js:2830

Cheers,

minicuper commented 10 years ago

It's an error with racer and racer-browserchannel versions. Go to the root project folder and make: rm -rf node_modules npm cache clean npm i then try again

codingisacopingstrategy commented 10 years ago

Thanks, that works!

Out of curiosity, how come it sometimes works to clean the npm cache? If code changes, a new version needs to be released, and NPM shouldn’t used the cached version no?

minicuper commented 10 years ago

Read the funny story

Moral of the story, when something seems fishy with a module you are installing, you’ve tried everything and nothing else seems to work, clear you cache! It might save you from switching professions.

codingisacopingstrategy commented 9 years ago

Hmm, I seem to run into the same problem again!

And this time I effectuated the whole npm remove / cache-clean / re-install procedure…

Chrome Canary

 Uncaught TypeError: Cannot read property 'replace' of undefined
codemirror-42c5fa3b215dad52168495e7225a7907.js:16125 TypeError: Cannot read property 'replace' of undefined {stack: (...), message: "Cannot read property 'replace' of undefined"}
codemirror-42c5fa3b215dad52168495e7225a7907.js:14650 Uncaught TypeError: Cannot read property 'replace' of undefined

Firefox 34.0

TypeError: a is undefined
Stack trace:
Showdown.converter/this.makeHtml@http://localhost:8003/showdown/showdown.js:62:1096
require<[3]</</SD.prototype.convert@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:130:14
require<[3]</</SD.prototype.create/<@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:123:5
modelListener@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:11452:5
require<[4]</EventEmitter.prototype.emit@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:234:7
require<[43]</Model.prototype.emit@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:11298:1
subscribeDocCallback@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:13856:1
require<[61]</Doc.prototype._finishSub@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:15555:7
require<[61]</Doc.prototype._handleSubscribe@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:15298:5
require<[61]</Doc.prototype._onMessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:15323:7
require<[60]</Connection.prototype.handleMessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:14736:7
require<[60]</Connection.prototype.bindToSocket/socket.onmessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:14645:7
Channel/socket.onmessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:9394:18
require<[12]</Socket.prototype._ws_onmessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:2193:21
codingisacopingstrategy commented 9 years ago

Tried this on another computer, OS X 10.9.5, fresh git clone, fresh NPM, node v0.10.33.

Same error. Maybe this issue can be re-opened?

In Chrome 39.0.2171.71 the error is:

events.js:59 Uncaught TypeError: Cannot read property 'replace' of undefined
microevent.js:45 TypeError: Cannot read property 'replace' of undefined {stack: (...), message: "Cannot read property 'replace' of undefined"}microevent.js:45 MicroEvent.emitconnection.js:126
socket.onmessageChannel.js:19 Channel.socket.onmessagebrowser.js:63 Socket._ws_onmessage
connection.js:129 Uncaught TypeError: Cannot read property 'replace' of undefined

In Firefox 33.1.1:

TypeError: a is undefined showdown.js:62
TypeError: a is undefined
Trace de la pile :
Showdown.converter/this.makeHtml@http://localhost:8003/showdown/showdown.js:62:1096
require<[3]</</SD.prototype.convert@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:130:14
require<[3]</</SD.prototype.create/<@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:123:5
modelListener@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:11452:5
require<[4]</EventEmitter.prototype.emit@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:234:7
require<[43]</Model.prototype.emit@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:11298:1
subscribeDocCallback@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:13856:1
require<[61]</Doc.prototype._finishSub@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:15555:7
require<[61]</Doc.prototype._handleSubscribe@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:15298:5
require<[61]</Doc.prototype._onMessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:15323:7
require<[60]</Connection.prototype.handleMessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:14736:7
require<[60]</Connection.prototype.bindToSocket/socket.onmessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:14645:7
Channel/socket.onmessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:9394:18
require<[12]</Socket.prototype._ws_onmessage@http://localhost:8003/derby/codemirror-42c5fa3b215dad52168495e7225a7907.js:2193:21
 codemirror-42c5fa3b215dad52168495e7225a7907.js:16125
enjalot commented 9 years ago

I fixed this in the d-showdown component. there was a null-check error where showdown chokes if you try to convert undefined into html :) npm install d-showdown should fix it.