Node: bad option: --nocrankshaft


#1

Trying to run the sample app on the Node.JS website to start an http server.

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
    res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});

server.listen(port, hostname, () => {
console.log('Server running at http://${hostname}:${port}/');
});

I’m getting this error in the C9 IDE:

node: bad option: --nocrankshaft

I’ve tried updating to the latest Node release to no avail.


#2

have same problem… below is my codes

let port = process.env.PORT;
let host = process.env.IP;

app.listen(process.env.PORT, host, () => { 
    console.log('Running on port ' + port + ' and IP ' + host);
});

i’m using default node.js runner…


#3

Same here. I’m just trying to run the exact example provided by the ‘node-horseman’ package:

var Horseman = require('node-horseman');
var horseman = new Horseman();

horseman
  .userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
  .open('http://www.google.com')
  .type('input[name="q"]', 'github')
  .click('[name="btnK"]')
  .keyboardEvent('keypress', 16777221)
  .waitForSelector('div.g')
  .count('div.g')
  .log() // prints out the number of results
  .close();

Output:

Your code is running at https://horseman-scraper-nmaxcom.c9users.io.
Important: use process.env.PORT as the port and process.env.IP as the host in your scripts!

node: bad option: --nocrankshaft

Process exited with code: 9


#4

The only way I found is run node server.js at the terminal.


#5

I had same problem.
I changed the runner from Node.js(default) to Node 0.10.x, It worked.


#6

Thanks, running it the terminal and/or changing to the 0.10.x runner worked. However the 0.10.x runner doesn’t allow ES6 fat arrow functions, so I’m using the terminal approach.


#7

This happened to me as well, it happened after i updated nodejs via nvm install. Changing the runner to 0.10.x worked.

Edit: I managed to use Runner: Node.js (default) by disabling the Run in Debug Mode option (the button next to the runner list).