duojs / duo

A next-generation package manager for the front-end
3.42k stars 118 forks source link

var Duo = require('../../'); error! #466

Closed xiaoice closed 9 years ago

xiaoice commented 9 years ago

code: var Duo = require('../../');

console: Error: Cannot find module '../../'

why?

dominicbarnes commented 9 years ago

Duo restricts itself only to the root of your project. (ie: the directory you are running duo from)

If you want to be able to require something, it needs to be within your project's hierarchy.

xiaoice commented 9 years ago

thanks!

code:// Duo.prototype.cleanCache = function *() { debug('clearing cache'); yield rm(this.installPath('duo.json')); };

console:// Duo.prototype.cleanCache = function () { ^ SyntaxError: Unexpected token at exports.runInThisContext (vm.js:73:16) at Module._compile (module.js:443:25) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at Object. (D:\work\jumi\branch\h5\v1.0.0\Hz -jumi\gulpfile.js:2:11) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10)


node -v : v0.12.2

dominicbarnes commented 9 years ago

You need to use the --harmony-generators flag if you're not using the CLI.

xiaoice commented 9 years ago

thanks! like this: https://github.com/duojs/duo/blob/master/examples/gulpfile/gulpfile.js

how to start?

dominicbarnes commented 9 years ago

I don't use gulp, personally. If it's part of your usual toolset, then that's probably a great start.

If you're just getting started, the CLI is pretty easy-to-use. (I often use a Makefile w/ the CLI directly)

dominicbarnes commented 9 years ago

If you have further one-off questions like this, head on over to the gitter chat room. I'll close this issue now.

xiaoice commented 9 years ago

ok,thanks!

dominicbarnes commented 9 years ago

No problem! I hope you enjoy using duo :)