derbyparty / generator-derby Goto Github PK
View Code? Open in Web Editor NEWYeoman generator that scaffolds out a Derby 0.6 project.
Yeoman generator that scaffolds out a Derby 0.6 project.
I I get the following error:
daslicht:simple daslicht$ yo derby
Derby 0.6 Project generator:
? Select Project level features Redis
? Input Derby-app name simple
? Select "simple"-application features derby-router, Bootstrap 3
create config/defaults.json
create public/img/favicon.ico
create server/error.js
create server/routes.js
create server/config.js
create server/express.js
create server/store.js
create server.js
create package.json
create .gitignore
create README.md
create apps/error/index.js
create apps/error/views/index.html
create apps/error/views/403.html
create apps/error/views/404.html
create apps/error/views/500.html
create apps/error/styles/index.css
create apps/error/styles/reset.css
create apps/simple/index.js
create apps/simple/views/index.html
create apps/simple/views/home.html
create apps/simple/styles/index.css
I'm all done. Running npm install
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No license field.
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "[email protected]" "sharedb-mongo" "racer-bundle" "racer-highway" "coffeeify" "coffee-script" "async" "chalk" "express" "connect-mongo" "cookie-parser" "body-parser" "express-session" "serve-static" "compression" "serve-favicon" "redis-url" "sharedb-redis-pubsub" "derby-debug" "d-bootstrap" "derby-router" "--save"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! version not found: [email protected]
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/daslicht/DEV/node/derby/simple/npm-debug.log
All is done, to start app use: npm start
daslicht:simple daslicht$ npm install
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No license field.
daslicht:simple daslicht$ ls
README.md components package.json server test
apps config public server.js
daslicht:simple daslicht$ npm install
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No license field.
daslicht:simple daslicht$ npm start
> [email protected] start /Users/daslicht/DEV/node/derby/simple
> node server.js
module.js:339
throw err;
^
Error: Cannot find module 'async'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/daslicht/DEV/node/derby/simple/server.js:1:75)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! This is most likely a problem with the simple package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls simple
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/daslicht/DEV/node/derby/simple/npm-debug.log
daslicht:simple daslicht$
This should be "bootstrap.html", right?
Upgrading to the last version 0.6.0, trying to create a new derby project I receive a fatal error.
I'm using Ubuntu 13.10, node v0.10.29, npm 1.5.0-alpha-1, yo 1.2.1, generator-derby 0.6.0 .
$ yo derby
Error: Cannot find module '../util.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/generator-derby/app/index.js:6:21)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Looking inside the component installation dir it seems there are not all the necessary file.
$ ls -l /usr/lib/node_modules/generator-derby/
total 16
drwxr-xr-x 3 user1 user1 4096 Aug 20 13:20 app
drwxr-xr-x 7 user1 user1 4096 Aug 20 13:20 node_modules
-rw-r--r-- 1 user1 user1 2077 Aug 20 13:20 package.json
-rw-r--r-- 1 user1 user1 2905 Aug 17 18:42 README.md
Am I wrong, or component
dir and utils.js
are missing?
Installing modules globally requires sudo
, but it obviously leads to all package.json
files in ~/.npm/*/*/package/
being owned by the root user.
Thus, sudo
is required to run yo derby
, but running as root will cause access errors for all files owned by me.
In addition, two more files owned by root caused errors for me:
update-notifier-generator-derby.yml
and
update-notifier-yo.yml
in ~/.config/configstore/
.
I was able to fix it by chown
-ing them, but is it supposed to be like that? If so, it should be stated in the quick start guide on http://derbyjs.com/learn
(There was actually a 3rd error: missing g++, which can be fixed with
sudo apt-get install build-essential g++
)
Hello,
I try to create a component with a command:
yo derby:component "list"
Derby 0.6 Project generator:
[?] Select Project level features: (Press <space> to select)
❯⬡ Redis
⬡ Derby-login
⬡ Racer-schema
⬡ Bower
I run this inside of a project dir, but it appears to me that generator attempts to create a new app instead of a component.
And the second problem is that not all components must be shared between applications, some apparently belong to the certain ones. Probably we should generate a component inside of a current directory of it's not root.
Followed install instructions verbatim, got this:
> node server.js
module.js:340
throw err;
^
Error: Cannot find module 'derby'
It looks like the package.json's dependencies are completely empty. Shouldn't there be....well, many listed dependencies? Or did I miss a step?
Thanks :)
When I create derby project using generator-derby and run it like this:
NODE_ENV=production node server
app is still available on client side, i.e. derby.util.isProduction is undefined here:
if (!derby.util.isProduction) global.app = app;
I'm not sure that is generator-derby issue, but generated derby app with following options throws error:
yo derby
? Select Project level features: Derby-login, Bower
? Select derby-login packages: Google, Facebook, Vkontakte
? Input Derby-app name: app
? Select "app"-application features: Jade, Stylus, Bootstrap 3
npm start
Error in browser console:
Uncaught Error: Cannot find view "node_modules\d-bootstrap\dropdown" in
TitleElement
BodyElement
Title
Body
Tail
dropdown
modal
tabs
auth:changepassword
auth:login
auth:register
home
header
footer
app-103c04857234ad1b73779810c8443457.js:2914App.component app-103c04857234ad1b73779810c8443457.js:2914module.exports app-103c04857234ad1b73779810c8443457.js:70use app-103c04857234ad1b73779810c8443457.js:11126(anonymous function) app-103c04857234ad1b73779810c8443457.js:9require.d-bootstrap app-103c04857234ad1b73779810c8443457.js:21s app-103c04857234ad1b73779810c8443457.js:1e app-103c04857234ad1b73779810c8443457.js:1(anonymous function) app-103c04857234ad1b73779810c8443457.js:1
Windows 8.1 x64 | Node.js 0.10.31 | derby 0.6alpha24 | generator-derby 0.6.5
It would be great if we could generate new Derby project directly with Bootstrap 2 or 3 in it.
Hello,
After a fresh project generation using yo derby
with the following options:
After I run npm-start
, I'm seeing the following error:
/Users/curran/repos/derbyTest2/node_modules/derby-login/lib/middleware/index.js:40
backend.addProjection(options.publicCollection, options.collection, 'json0', options.user);
^
TypeError: Cannot read property 'addProjection' of undefined
at Login.middleware (/Users/curran/repos/derbyTest2/node_modules/derby-login/lib/middleware/index.js:40:10)
at module.exports (/Users/curran/repos/derbyTest2/server/express.js:36:21)
at /Users/curran/repos/derbyTest2/server.js:24:3
at Racer.Derby.run (/Users/curran/repos/derbyTest2/node_modules/derby/lib/Derby.server.js:17:5)
at Object.<anonymous> (/Users/curran/repos/derbyTest2/server.js:9:7)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:429:10)
at startup (node.js:139:18)
at node.js:999:3
I did a little debugging, and it turns out that backend
is undefined. This seems like an API change somewhere. Here are the versions of various packages from my generated package.json
:
{
"name": "derbytest2",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"async": "^1.5.2",
"body-parser": "^1.14.2",
"chalk": "^1.1.1",
"coffee-script": "^1.10.0",
"coffeeify": "^2.0.1",
"compression": "^1.6.0",
"connect-mongo": "^0.8.2",
"cookie-parser": "^1.4.1",
"derby": "^0.8.0",
"derby-debug": "^0.1.0",
"derby-jade": "^0.6.21",
"derby-login": "^0.4.16",
"derby-router": "^0.3.3",
"derby-stylus": "^0.1.0",
"express": "^4.13.3",
"express-session": "^1.13.0",
"passport-google-oauth": "^0.2.0",
"racer-bundle": "^0.2.4",
"racer-highway": "^7.0.0",
"redis-url": "^1.2.1",
"serve-favicon": "^2.3.0",
"serve-static": "^1.10.0",
"sharedb-mongo": "^0.8.7",
"sharedb-redis-pubsub": "^0.3.1"
},
"author": {
"name": "Curran",
"email": "[email protected]"
},
"license": "",
"readme": "derbytest2\n",
"readmeFilename": "README.md"
}
Any ideas on this? I may try reverting some packages, like sharedb-mongo, to older releases and see if that makes the issue go away. Thank you.
In case it is relevant, here are my mongod and redis-server versions:
MacBook-2:derbyTest2 curran$ mongod --version
db version v2.6.7
MacBook-2:derbyTest2 curran$ redis-server --version
Redis server v=2.6.9 sha=00000000:0 malloc=libc bits=64
Hy everybody,
First of all thanks for your effort in doing this!
Trying to understand the generated code, I saw that you use app.router()
middleware at line 39, but app
is never defined in here a part from the apps.forEach()
callback parameter at line 33.
So my question is: what is or should refer to app
at line 33?
Greetings,
Matteo
I tryed generate derby application with only Bootstrap and I have error:
? Select Project level features: Derby-login
? Select derby-login packages:
? Input Derby-app name: private-todos
? Select "private-todos"-application features: Bootstrap 3
create config/defaults.json
create config/login.js
create public/img/favicon.ico
create server/error.js
create server/routes.js
create server/config.js
create server/express.js
create server/store.js
create server.js
create package.json
create .gitignore
create README.md
create apps/error/index.js
create apps/error/views/index.html
create apps/error/views/403.html
create apps/error/views/404.html
create apps/error/views/500.html
create apps/error/styles/index.css
create apps/error/styles/reset.css
/usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/lib/actions/actions.js:194
throw new Error('Unable to read "' + filepath + '" file (Error code: ' + e
^
Error: Unable to read "/usr/lib/node_modules/generator-derby/app/templates/apps/app/views/_register.bootstrap.html" file (Error code: ENOENT).
at read (/usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/lib/actions/actions.js:194:11)
at template (/usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/lib/actions/actions.js:280:19)
at yeoman.generators.Base.extend.app (/usr/lib/node_modules/generator-derby/app/index.js:440:12)
at /usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/lib/base.js:341:43
at /usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/node_modules/async/lib/async.js:551:21
at /usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/node_modules/async/lib/async.js:227:13
at iterate (/usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/node_modules/async/lib/async.js:134:13)
at /usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/node_modules/async/lib/async.js:145:25
at /usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/node_modules/async/lib/async.js:229:17
at /usr/lib/node_modules/generator-derby/node_modules/yeoman-generator/node_modules/async/lib/async.js:556:34
If an error occurs during the bundle, such as a missing require which only occurs during the
browserify step, the error is ignored.
I suggest adding some error handling to:
https://github.com/derbyparty/generator-derby/blob/master/app/templates/_server.js#L32
but I'm not sure if there is any other issues, or if something should be added upstream to derby ?
Within generator-derby/component/templates/_package.json
"peerDependencies": {<% if (stylus) { %>
21 "derby-jade": "*",<% } %><% if (jade) { %>
22 "derby-stylus": "*",<% } %><% if (coffee) { %>
23 "coffee-script": "*",<% } %>
Currently, sessions don't get set properly. This is because the store.modelMiddleware is triggered before the session middleware. I.e. the following line https://github.com/derbyparty/generator-derby/blob/master/app/templates/server/_express.js#L31 needs to move below the session middleware (located here: https://github.com/derbyparty/generator-derby/blob/master/app/templates/server/_express.js#L35 ).
Should both be fixed in the coffee template version and the regular template version. I'm tbh not exactly sure why this happens, but it has something to do with that the store.modelMiddleware middleware triggers adding a express-session kind of instance (or something), but it is prematurely (when it is actually triggered, it cancels because "it's already been initiated" - although not in a proper way).
Master pid 29227
/www/tmp/derby/node_modules/derby-login/lib/middleware/index.js:40
backend.addProjection(options.publicCollection, options.collection, 'json0', options.user);
^
TypeError: Cannot read property 'addProjection' of undefined
at Login.middleware (/www/tmp/derby/node_modules/derby-login/lib/middleware/index.js:40:10)
at module.exports (/www/tmp/derby/server/express.js:36:21)
at /www/tmp/derby/server.js:24:3
at Racer.Derby.run (/www/tmp/derby/node_modules/derby/lib/Derby.server.js:17:5)
at Object.<anonymous> (/www/tmp/derby/server.js:9:7)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:118:18)
at node.js:952:3
Step 1. yo derby with options:
? Select Project level features: Derby-login, Racer-schema, Bower
? Select derby-login packages: Google, Facebook, Vkontakte
? Input Derby-app name: app
? Select "app"-application features: Jade, Stylus
Step 2. Add register view to body
view(name="auth:register")
Step 3. Try to register:
Error: No schema for collection: auths
Windows 8.1 x64 | Node.js 0.10.31 | derby 0.6alpha24 | generator-derby 0.6.5
If we don't choose to use the derby-login module during the generation (<% if (!login) { %>
), in the express.js
file under the server/
dir at line 36 you do .use(createUserId)
.
However the createUserId()
function is defined only if the derby-login module is chosen during the generation (<% if (login) { %>
).
Before the inclusion of the derby-login module during the generation, the createUserId
function was defined and used anyway.
Which is the correct behavior?
It would be really nice if the browserify / bundling step could be skipped, for example when the server crashes and forever or pm2 or whatever restarts the app. The bundling can take quite a lot of time, especially when in NODE_ENV=production mode.
I'm talking about simply reusing the latest bundled .js file.
In dependencies the derby-stylus present nib and in derby-stylus/index.js
on line 14 i see .use(nib())
.
Therefore, we can write:
@import 'nib'
global-reset()
in index.styl.
Especially strange after the index to apply reset
In order to make Derby work on Windows, there's a problem with the browserify-process - and more specifically that that browserify-dependency path-browserify (also maintained by substack) only works for posix. I have a patched version of path-browserify, but it doesn't seem like substack is keen on checking anything in the path-browserify -repo, so until then the most convenient way is to add a npm-shrinkwrap.json -file (this is how we currently deal with it). Note that this does not in any way remove posix support in favor of windows, rather it just adds the windows compatibility (actually, it is just a very slightly slightly modified version of the code that is used internally in node).
See below for how a shrinkwrap file can look like to fix the issue. Unfortunately I'm no export at Yeoman, so I leave implementing the shrinkwrap file up to you ;-) (if that changes, I'll make a PR instead).
{
"dependencies": {
"browserify": {
"version": "12.0.1",
"from": "browserify@>=12.0.1 <13.0.0",
"dependencies": {
"path-browserify": {
"version": "0.1.0",
"from": "git://github.com/bbweb/path-browserify.git#general-version"
}
}
}
}
}
Could not create a new project using version [email protected]
$ yo derby project-name
Error: Cannot find module '../util.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-derby/app/index.js:6:21)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
При генерации приложения с включенной опцией derby-login получаемое приложение выдает 404.
derby-login по умолчанию требует авторизацию для любого запроса и перекидывает на авторизацию по пути /login . В сгенерированном приложении такой путь никак не обрабатывается, отсюда и 404. Чтобы начать работу приходится либо отключать middleware derby-login либо переопределять хук request в config/login.js
hooks :{
request: function(req, res, userId, isAuthenticated, done) {
done();
},
либо заниматься реализацией авторизации.
Не страшно, конечно, просто приходится ковыряться, чтобы заставить сгенерированное приложение работать.
Feature request!
It would be greate to have an app generator, to generate more derby apps in same project.
yo derby --coffee
Error: Cannot find module 'derby-markdown'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at App.serverUse (/home/ovvn/webdev/mathforces/node_modules/derby/node_modules/racer/lib/util.js:168:23)
at Object.<anonymous> (/home/ovvn/webdev/mathforces/apps/mathforces/index.coffee:12:5)
at Object.<anonymous> (/home/ovvn/webdev/mathforces/apps/mathforces/index.coffee:1:1)
at Module._compile (module.js:456:26)
at Object.loadFile (/home/ovvn/webdev/mathforces/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
at Module.load (/home/ovvn/webdev/mathforces/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /home/ovvn/webdev/mathforces/server.coffee:14:5
at Racer.Derby.run (/home/ovvn/webdev/mathforces/node_modules/derby/lib/Derby.server.js:17:5)
at Object.<anonymous> (/home/ovvn/webdev/mathforces/server.coffee:9:7)
at Object.<anonymous> (/home/ovvn/webdev/mathforces/server.coffee:1:1)
at Module._compile (module.js:456:26)
at Object.exports.run (/home/ovvn/webdev/mathforces/node_modules/coffee-script/lib/coffee-script/coffee-script.js:119:23)
at compileScript (/home/ovvn/webdev/mathforces/node_modules/coffee-script/lib/coffee-script/command.js:208:29)
at compilePath (/home/ovvn/webdev/mathforces/node_modules/coffee-script/lib/coffee-script/command.js:161:14)
at Object.exports.run (/home/ovvn/webdev/mathforces/node_modules/coffee-script/lib/coffee-script/command.js:96:21)
at Object.<anonymous> (/home/ovvn/webdev/mathforces/node_modules/coffee-script/bin/coffee:7:41)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Running the generator with derby-login option if you run the app you get an error
404 Sorry, we can't find anything at /login.
It appear there is an app missing for login.
> node server.js
Master pid 4847
4848 listening. Go to: http://localhost:3000/
derbyapp/node_modules/derby/lib/App.server.js:153
cb();
^
TypeError: undefined is not a function
at ~/derbyapp/node_modules/derby/lib/App.server.js:153:5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.