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

Fresh project does not work. #171

Closed
kaukas opened this issue Nov 21, 2012 · 41 comments
Closed

Fresh project does not work. #171

kaukas opened this issue Nov 21, 2012 · 41 comments

Comments

@kaukas
Copy link

kaukas commented Nov 21, 2012

$ uname -a
Darwin <...> 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
$ node -v
v0.8.14
$ /usr/local/share/npm/bin/derby --version
0.3.13

$ cd /tmp/testapp
$ /usr/local/share/npm/bin/derby new
<...>
$ node server.js

Open http://localhost:3000/ in Firefox 17. Console:

TypeError: module.require is undefined
<...> localhost:3000 (line 70)
ReferenceError: DERBY is not defined
<...> localhost:3000 (line 70)

Same for Chrome.

As a side note, do you do TDD for the framework? The last commit in lib is 2 days old while the last commit in test is 5 months old.

@lefnire
Copy link
Contributor

lefnire commented Nov 21, 2012

I was encountering a different issue than you (see #172).

As far as your steps, it should be more like:

$ cd /tmp
$ /usr/local/share/npm/bin/derby new testapp
$ cd testapp && npm install
$ node server.js

Re: TDD - they do it. They're mostly fixing bugs at this point, and you don't often need to add new test-cases in for that.

@kaukas
Copy link
Author

kaukas commented Nov 21, 2012

Re: steps - the same result.
Re: fixing bugs - what kind of TDD are you referring to? Both Wikipedia and Uncle Bob say that you have to write a test before doing anything else. How can you fix a bug without writing a test first?

@lefnire
Copy link
Contributor

lefnire commented Nov 21, 2012

Very strange... these steps gave me a working site at localhost:3000

$ cd ~/tmp
$ npm uninstall -g derby
$ npm cache clean
$ npm install -g derby
npm http GET https://registry.npmjs.org/derby
...
$ derby new test
$ cd test && npm install
$ node server.js

Worst case, I usually copy/paste an existing derby-example as new project codebases rather than running derby new, you get more scaffolding that way. Try derby-auth since it's pretty up-to-date.

@lefnire
Copy link
Contributor

lefnire commented Nov 21, 2012

That looks like maybe a socket.io issue? Or maybe browserify?

@kasima
Copy link

kasima commented Nov 21, 2012

Running into same issue. Fresh project gets me:

Uncaught TypeError: Cannot call method 'apply' of undefined /node_modules/derby/node_modules/racer/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js:143
Uncaught ReferenceError: DERBY is not defined b5vt9e:70

On Chrome 23.

@kasima
Copy link

kasima commented Nov 21, 2012

Looks like it was a change in the uglify-js package. I ended up pinning racer to uglify-js 1.3.x. Until they fix it, you can add my fork of derby into package.json and it seems to work again.

"dependencies": {
  "derby": "git://github.com/kasima/derby.git",
  "express": "3.0.0beta4",
  "gzippo": ">=0.1.7"
},

@kaukas
Copy link
Author

kaukas commented Nov 22, 2012

Seems to fix the issue for me, at least for now!
Thank you!

@lefnire
Copy link
Contributor

lefnire commented Dec 1, 2012

fixed in fa54cc380b, use edge - reopen if still issue

@danawoodman
Copy link

Using both the fork mentioned and the master branch of Derby and I still get the error.

I have spent the last 4 hours pulling my hair out trying to figure this out. At the verge of abandoning this for Meteor even though I don't want to.

I'm running latest node/npm, created app with `derby new appname' and following all on screen instructions. App loads but JS is broken, no interactivity works.

Am I missing something or is Derby broken right now?

@reneclaus
Copy link

I was having the same problem today. It seems to be a problem with the version of browserify. If you go into the package.json for racer and change it from "browserify": ">=1.13.3" to "browserify": "1.13.3" it'll fix it.

@uwbas
Copy link

uwbas commented Dec 30, 2012

Just did my first install of Derby 0.3.13, node v0.8.16, following the instructions on derbyjs.com. I get the same error in Firefox as OP.

For Racer I pinned uglify-js to 1.3.1, and browserify to 1.13.3, as described. Uninstalled and installed both modules using npm. Started server again. Now getting a different error:
TypeError: page is undefined
http://localhost:3000/gen/GacXp0ZPPeVMVqJD_gVJpQ.js
Line 3313

@IvanGaravito
Copy link

Try Derby "Edge", I have my app working fine!

@hughlomas
Copy link

If anyone else is having issues using Derby "Edge" in Windows due to a cryptic message: "CreateProcessW: The system can not find the file specified".

It's because it is looking for git.exe, which is not in your PATH. Just add git's \bin to your PATH environment variable. By doing that everything seems to be up and running for the fresh project.

Taken from this page http://architects.dzone.com/articles/my-tale-npm-woe-when-all-else

@lefnire
Copy link
Contributor

lefnire commented Jan 3, 2013

@hughlomas I added mention to that comment in the wiki, thanks

@VanCoding
Copy link

This issue still is there!
I just installed derby using "npm install -g derby", created an app using "derby new myapp" and started it using "node myapp/server".

When loading the page, I still get
Uncaught TypeError: Cannot call method 'apply' of undefined /node_modules/derby/node_modules/racer/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js:143 Uncaught ReferenceError: DERBY is not defined b5vt9e:70

Swithing to the "Edge" also doesn't work. The errors are different, tough.

@mateodelnorte
Copy link

I'm experiencing the same.

@adowning
Copy link

adowning commented Jan 5, 2013

same here too, frustrating

@switz
Copy link

switz commented Jan 5, 2013

This is definitely a work in progress, and I can't promise you anything, but if you don't mind using coffee script feel free to try out my derby boilerplate project. I just started it yesterday so there might be some things wrong with it, but try it as a last resort. Pull request away!

https://github.com/switz/derby-boilerplate

On Saturday, January 5, 2013 at 11:55 AM, adowning wrote:

same here too, frustrating


Reply to this email directly or view it on GitHub (#171 (comment)).

@hughlomas
Copy link

for the last few people

  1. npm install -g derby
  2. derby create projectname
  3. edit your dependencies in your project's package.json to include
    "derby": "git://github.com/codeparty/derby#master", "racer": "git://github.com/codeparty/racer#master"
  4. npm install inside of your project

if that doesn't work, try deleting the derby folder in \node_modules and run npm install again

@mateodelnorte
Copy link

Here's my analysis of the problem: https://gist.github.com/4462624

It seems that either a function in amd's amdefine.js called trimDots() needs to trim falsy array elements (the "" empty string before other elements in an array from text like 'node_modules/bla/node_modules/blabla' having been split on '/') OR Derby is just writing these wrong.

Looking at browserify projects I've done previously, it looks like the problem may need to be fixed in trimDots.

I'd like to get someone's opinion who has looked at the codebase for more than an hour. ;)

@mateodelnorte
Copy link

@hughlomas I tried your fix and got the following error:

TEMPLATE ERROR
TypeError: Cannot read property 'history' of undefined
    at EventEmitter.Component (/Users/matt/development/playground/derby/node_modules/derby/lib/component.js:79:30)
    at createComponent (/Users/matt/development/playground/derby/node_modules/derby/lib/View.js:680:19)
    at partialBlock (/Users/matt/development/playground/derby/node_modules/derby/lib/View.js:847:16)
    at /Users/matt/development/playground/derby/node_modules/derby/lib/View.js:631:48
    at renderer (/Users/matt/development/playground/derby/node_modules/derby/lib/View.js:196:12)
    at render (/Users/matt/development/playground/derby/node_modules/derby/lib/View.js:199:12)
    at Object.get (/Users/matt/development/playground/derby/node_modules/derby/lib/View.js:263:30)
    at Object.View._render (/Users/matt/development/playground/derby/node_modules/derby/lib/View.server.js:310:23)
    at View.render (/Users/matt/development/playground/derby/node_modules/derby/lib/View.server.js:278:10)
    at Array.View._init [as 0] (/Users/matt/development/playground/derby/node_modules/derby/lib/View.server.js:291:5)

@VanCoding
Copy link

@mateodelnorte I can confirm that.

But that's also a bug that was already reported & fixed by @lefnire.

I now use his commit as dependency:
"derby": "git://github.com/lefnire/derby/#165dddccf474047986ec0babd8854adf6d39b176"

Completely remove the node_modules folder in your project, and then run "npm install" again.

@mateodelnorte
Copy link

Thanks

On Mon, Jan 7, 2013 at 11:55 AM, Patrik Stutz notifications@github.comwrote:

@mateodelnorte https://github.com/mateodelnorte I can confirm that.

But that's also a bug was already reported & fixed by @lefnirehttps://github.com/lefnire
.

I now use his commit as dependency:
"derby": "git://
github.com/lefnire/derby/#165dddccf474047986ec0babd8854adf6d39b176"

Completely remove the node_modules folder in your project, and then run
"npm install" again.


Reply to this email directly or view it on GitHubhttps://github.com//issues/171#issuecomment-11959732.

@CSilivestru
Copy link

I fixed my issues with DERBY not being defined by pinning the uglify-js version to 1.3.x in the racer package.json file as outline here: derbyjs/racer#56.

In addition, I added view.history._createPage(); to node_modules/derby/lib/derby.browser.js (after the tracks.setup call). The error I was receiving had to do with page being undefined so I defined it.

tracks.setup(appExports, createPage, onRoute);
view.history = appExports.history;
view.history._createPage();

This took care of all errors and had me up and running.

@cflynn07
Copy link

cflynn07 commented Jan 9, 2013

I'm having this problem as well

@maedi
Copy link

maedi commented Jan 11, 2013

Using master/edge (are they the same thing?) of derby and racer in package.json worked for me

@jfenton
Copy link

jfenton commented Jan 14, 2013

How is it that I can run into the same exact problem as the original ticket opener from 2 months ago.. poor show. First impressions matter.

@mateodelnorte
Copy link

#this

On Mon, Jan 14, 2013 at 10:26 AM, Jay Fenton notifications@github.comwrote:

How is it that I can run into the same exact problem as the original
ticket opener from 2 months ago.. poor show. First impressions matter.


Reply to this email directly or view it on GitHubhttps://github.com//issues/171#issuecomment-12222982.

@re1ro
Copy link
Member

re1ro commented Jan 15, 2013

@jfenton I might wanna comment on this. It's not any kind of show here. It's an open source project. That means people are always welcome to fork/change/fix things. There talented people who could be able to bring that kind of technology to the community. It was never easy to build such a complicated thing. And I see it being not easy to understand if you never tried to build something like that. Authors have dedicated huge amount of time to make it happen driven by enthusiasm. And they have a right to lack on free time right now.

I just can't accept this consuming attitude. And desire only to criticize, complain and blame people for not delivering free goods in time. I don't see a place for any kind of high expectation here, because it says at front that derby and racer is alfa software yet. And it's a subject to change or break because it keeps improving and it requires some incompatible updates

@lefnire
Copy link
Contributor

lefnire commented Jan 15, 2013

Hear hear! And that brought a pang of guilt for things I've previously said on this queue, myself. Good dose of perspective there.

@mateodelnorte
Copy link

@rma4ok I understand and appreciate this sentiment. And I think most people trying to download and learn to use derby are appreciative of the work being done.

The only thing I would add is that perhaps some care needs to be taken such that when people do a straight 'npm install derby' and run the tests or the example project - things don't fail. People are going to use this as the initial judge of whether derby is worthwhile, and that may determine if derby gains momentum or loses speed and is forgotten.

I would be happy to help. I can fork, make pull requests, check tests, whatever. But I think base tests and functionality from a plain 'npm install' need to be handled with care to work, especially when the project has published/updated more than 30 times on npm. For one reason or another people expect a little concreteness in first impression at that point - whether it's fair to do so or not.

So I think the question to ask is - How can those who are interested help ensure the first derby experience isn't broken on the latest version published via npm?

My guess is that this isn't a problem of just doing a pull request when there's a breakage. It's an opportunity to put a process in place to make sure builds with broken tests or examples aren't published.

</ my 2 cents>

Thanks for building awesome software, guys. I really agree with what you're building and the architectural choices you're making. And, I really really want to use it to build awesome stuff.

@IvanGaravito
Copy link

Hi guys!

I see you got some interisting issues when trying a new project, and this is really a pain when starting to try Derby, so I've decided to make a solution for these like me using Windows 7.

First you need to install Derby globally.

$ npm install -g derby

It's supposed that make should be executed and things are really pretty by constructing the ./lib/derby.js, but it isn't for Windows. So you need to find out and go to the npm base directory which looks something like $ cd /c/Users/<your user here>/AppData/Roaming/npm.

Once there, you need to enter at Derby global module and make it manually:

$ cd node_modules/derby
$ coffee -bw -o ./bin/lib -c ./bin/src
HH:MM:SS - compiled bin\src\derby.coffee

Maybe happens that coffee does not exit, just type CTRL + C

Now you are almost done, next steps you need to follow are go to your development directoy (e.g. /mydev/node) and create a new project.

$ cd /mydev/node
$ derby new test_01

Now Derby creates a new project that should work alright, but not yet. Reading Using Derby "Edge", wiki by @lefnire, you'll see that package.json needs to be modified.

Original package.json:

{
  "name": "test_01",
  "description": "",
  "version": "0.0.0",
  "main": "./server.js",
  "dependencies": {
    "derby": "*",
    "express": "3.0.0beta4",
    "gzippo": ">=0.1.7"
  },
  "private": true
}

Working package.json

{
  "name": "test_01",
  "description": "",
  "version": "0.0.0",
  "main": "./server.js",
  "dependencies": {
    "derby": "git://github.com/codeparty/derby#master",
    "racer": "git://github.com/codeparty/racer#master",
    "express": "3.0.0beta4",
    "gzippo": ">=0.1.7"
  },
  "private": true
}

Note: I use express >=3.0.0beta4 and it works alright!

Once your package.json has been fixed, then need to uninstall the local derby and reinstall modules:

$ npm uninstall derby
$ npm install

Now, after all these fixes have been made, then start enjoy Derby:

$ node server
   info  - socket.io started
Starting cluster with 1 workers in undefined mode
`kill -s SIGUSR2 6168` to force cluster reload
Go to: http://localhost:3000/
   info  - socket.io started

@jfenton
Copy link

jfenton commented Jan 15, 2013

@rma4ok Thanks for your comment. Mine was off a tad terse, and I could have been more delicate in my approach.

I stumbled upon Derby whilst looking for a collaborative sync framework, of which there are a small handful to choose from with Meteor being arguably the most popular and (now) well-funded. I needed it for a non-critical piece of work, and so was willing to live with early software, especially if I could help improve it along the way.

I tried Derby first. Why? Because from what I've read, it looks to be technically superior, better architected, better documented - kudos to all involved, to tick all three boxes is a great first impression. I wanted to play.

I'm no stranger to alpha quality software (have written a fair portion myself!), but imagine my surprise when neither the examples, nor even a fresh project work out of the box. Neither of these should ever be in a broken state.

How can I get passionate about this project, when I can't build anything with it? Open source projects fail because a community doesn't reach critical mass. We all have limited time - passion is the only thing that builds open source projects. I'm sure I'm not alone in failing to join this community as a result of this one easy-to-resolve bug. How many others are like me?

@kaukas
Copy link
Author

kaukas commented Jan 15, 2013

@jfenton, similar situation.

I wanted to use some cool same-code-both-sides real-time framework and Derby was the only one that I liked the docs and the idea of.

Lately when I start working on new languages or frameworks I start with tests. With Derby the TDD approach failed. I chose ZombieJS over PhantomJS (due to being npm-installable) and then spent hours trying to get a response from a test controller. With hacks (don't ask...) I succeeded in the end but with so much pain testing was obviously useless.

So I dropped the tests and tried to write something ad-hoc. But Derby kept throwing errors out of the box.

With the info on this thread I got it going somehow. The template changes would be rendered instantly but after every JS change I had to:

  • stop server
  • reload Firefox
  • start server
  • reload Firefox

Otherwise Firefox would throw errors multiple times per second (I forgot the exact error). I spent hours to come up with that workflow and still the resulting development process was very slow.

At that point I dropped the idea altogether. Either the framework is not yet usable or I misunderstand it. Since I'm new to node I assume the latter.

Hope to try again later!

@Xonzo
Copy link

Xonzo commented Jan 17, 2013

@kaukas Exact same situation. I have been screwing around for 2 hours trying to get Derby to work on Windows 7.

Following the exact steps of @IvanGaravito ... Now I just get completely different errors.

@jonnymd
Copy link

jonnymd commented Jan 22, 2013

Fixed by switching to "Edge" (https://github.com/codeparty/derby/wiki/Using-Derby-%22Edge%22).

edit your app's project.json file to have:
{
...
"dependencies": {
"derby": "git://github.com/codeparty/derby#master",
"racer": "git://github.com/codeparty/racer#master",
}
...
}

Did those that tried switching but still had this problem follow directions at the bottom to remove node_modules/derby and re-install via npm?

rm -rf node_modules/derby
npm install

The issue was brought up again 2 days ago (Issue #201) so I'd love to see people get this simple fix. Production ready? NO! But an easy/simple/quick fix for checking out the project and keeping the gitHub momentum. It would be wonderful to have a simpler fix for the dependencies. I don't understand enough about it to realize WHY hard-coding new projects to the Derby Edge dependencies (as the default/out-of-the-box-behavior) is a bad idea but from what I read I trust that it is in fact BAD (like referring to nightly builds essentially I guess). However, isn't a working new-app creation better than not, even if it's dependencies are based on Derby Edge? If so, maybe that should be changed until a more elegant solution is found...

@jfenton
Copy link

jfenton commented Jan 22, 2013

Thanks @jonnymd, I agree this does result in a working setup. At such an early stage of the project, I think really it should be tracking master, or at least a release that has a more regular cadence - perhaps gated by a CI tool?

As the current official release is completely broken (did anyone test it? Guess not..), to all intents and purposes it's useless, and this should really be integrated and a new release made until there's a better solution.

@jonnymd
Copy link

jonnymd commented Jan 22, 2013

Is anyone else opposed to changing the dependencies for the "create" new project to Derby Edge? @lefnire : you've been one that I've followed quite a bit via your blog/git posts as it relates to the Derby movement (vs. Meteor or others). Do you have an opinion on this?

@phillc
Copy link

phillc commented Jan 24, 2013

I was able to get derby to work using the above package.json. However, if you try to do a simple "curl localhost:3000", it will respond with "Not Found%". The problem goes away if you remove the line that uses gzippo. I am trying to investigate further.

edit: Found it: tomgco/gzippo#47 freezing gzippo to 0.1.7 fixed it.

@jtmalinowski
Copy link

After upgrading to edge derby, I get

node_modules/gzippo/lib/staticGzip.js:108
staticSend(req, res, next, o);
^
TypeError: undefined is not a function
at pass (/home/developer/code/derby-test/node_modules/gzippo/lib/staticGzip.js:108:4)
at module.exports (/home/developer/code/derby-test/node_modules/gzippo/lib/staticGzip.js:177:12)
at Object.oncomplete (fs.js:297:15)

with gzippo 0.1.7, however gzippo 0.2.0 is working fine except for the curl issue. Please post your dependencies from package.json together with actual versions installed so I can take a stab at it, thanks.

@lefnire
Copy link
Contributor

lefnire commented Feb 4, 2013

you may want to use derby-boilderplate as a starter, rather than derby's default. See the bottom of the updated Edge wiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests