metalsmith: Version 2.0.1 broken?

The following code copies files from src to build on 1.7.0

var Metalsmith = require('metalsmith');

Metalsmith(__dirname)
    .destination('./build')
    .build(function (err) {
        // For error handling
        if (err) {
            throw err;
        }
    });

However, 2.0.1 errors with:

/home/my_path/node_modules/metalsmith/lib/index.js:190
Metalsmith.prototype.build = unyield(function*(){
                                             ^
SyntaxError: Unexpected token *
    at Module._compile (module.js:439:25)
    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)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/woody/Documents/test/node_modules/metalsmith/index.js:6:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

Is this a problem or do I need to change how I’m using Metalsmith.

Node: v0.10.29

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

You need to run it with $ node --harmony index since the asterix (*) is part of ES6 syntax.

You can also install metalsmith globally and creating a metalsmith.json in your project folder and then just run $ metalsmith