Support for ES6 modules syntax on IBM bluemix

0 votes

I'm trying to deploy an app that uses ES6 statements on ibm cloudfoundary. the logs are showing that it starts with node 6.8.0, this is the prompt that comes up:

 Unexpected token import

I tried running it on my windows 10 desktop it runs without any hitch:

console.log(process.versions);

This is the output:

{ http_parser: '2.7.0',
  node: '6.8.0',
  v8: '5.1.281.84',
  uv: '1.9.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  icu: '57.1',
  modules: '48',
  openssl: '1.0.2j' }

The output is same on my system and bluemix server. but it is not working on bluemix. Here's the package.json:

    {
  "name": "bluemixtest",
  "version": "0.0.0",
  "main": "server/app.js",
  "dependencies": {
  },
  "devDependencies": {
  },
  "engines": {
    "node": "6.8.0"
  },
  "scripts": {
    "start": "node --harmony_modules server/app.js"
  },
  "private": true
}

server/app.js:

'use strict';
import express from 'express';
import mongoose from 'mongoose';

Startup error in logs :

/home/vcap/app/server/app.js:7
import express from 'express';
^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
npm ERR! Linux 3.19.0-33-generic
npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
npm ERR! node v6.8.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! bluemixtest@0.0.0 start: `node --harmony server/app.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bluemixtest@0.0.0 start script 'node --harmony server/app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bluemixtest package,
npm ERR! not with npm itself.
Aug 10, 2018 in DevOps on Cloud by Atul
• 10,240 points
737 views

1 answer to this question.

0 votes

There is no native support for es6 standards yet. "Import" ES6 for Node

answered Aug 10, 2018 by ajs3033
• 7,300 points

Related Questions In DevOps on Cloud

+2 votes
3 answers

How do I deploy Scala PlayFramework Project to IBM Bluemix

It seems that they are more than ...READ MORE

answered Oct 18, 2018 in DevOps on Cloud by lina
• 8,220 points
1,227 views
0 votes
1 answer
+3 votes
2 answers
0 votes
1 answer

How to manage Application version for VM's in Azure Autoscaling group

First of all, You have to launch ...READ MORE

answered Apr 24, 2018 in DevOps on Cloud by shubham
• 7,340 points
1,155 views
+2 votes
1 answer
+1 vote
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,035 views
0 votes
1 answer
0 votes
1 answer

How can I remove a port from url for node app using nginx

If you run your node server on ...READ MORE

answered Apr 10, 2018 in DevOps on Cloud by ajs3033
• 7,300 points
4,027 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP