how to start global npm module with harmony flag
co, ecmascript-harmony, node.js, npm
Solution
`#!/usr/bin/env node --harmony`
on the top of script works for me, in your case in /bin/dm-npm
Problem
I wrote a npm module which can be installed globally dm-npm. I like to use co in that module. How can i told the module that it runs with the harmony flag when started globally? Here is the package.json: ``` { "name": "dm-npm", "version": "0.0.3", "description": "npm helper", "main": "index.js", "scripts": { "test": "mocha --reporter nyan", "start": "node --harmony ./bin/dm-npm" }, "repository": { "type": "git", "url": "https://github.com/divramod/dm-npm.git" }, "keywords": [ "npm", "template" ], "author": "", "license": "ISC", "bugs": { "url": "https://github.com/divramod/dm-npm/issues" }, "homepage": "https://github.com/divramod/dm-npm", "devDependencies": { "chai": "^2.1.0", "mocha": "^2.1.0" }, "dependencies": { "co": "^4.4.0", "co-prompt": "^1.0.0", "colors": "~1.0.3", "shelljs": "^0.3.0" }, "bin": { "dmnpm": "./bin/dm-npm" } } ``` i got the following error message when running with a co function: ``` > $ dmnpm init /usr/local/lib/node_modules/dm-npm/index.js:152 co(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.<anonymous> (/usr/local/lib/node_modules/dm-npm/bin/dm-npm:3:1) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) ``` it is caused by ``` co(function*() { var projectName = yield prompt('project name: '.blue); process.stdin.pause(); }); ```