Polymer CLI: SyntaxError: Unexpected strict mode reserved word - node.js

I'm trying to install the polymer CLI from here: https://www.polymer-project.org/1.0/docs/tools/polymer-cli
However, after installing it I get an error when trying to run polymer help:
[~/Documents/roottest]$ polymer help ruby:2.2.4
/opt/boxen/nodenv/versions/v0.10.26/lib/node_modules/polymer-cli/bin/polymer.js:19
let lib = path ? require(path) : require('..');
^^^
SyntaxError: Unexpected strict mode reserved word
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 Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
[~/Documents/roottest]$ node --version ruby:2.2.4
v0.10.26
[~/Documents/roottest]$ nodenv --version ruby:2.2.4
nodenv 0.3.3
My node version is v0.10.26, my nodeenv version is 0.3.3. I'm using Mac.
Does anyone know how I would fix this?

Polymer CLI is not compatible with Node v0.10.26.
The setup guide indicates that Node 4.x or newer is required. You should actually upgrade to the latest stable version (6.2.0).

Related

nodemon unexpected identifier [duplicate]

Whenever I try to run nodemon to auto-restart my local server (running on port 3000), I get this error message regarding a syntax error in the no
/Users/SI23/.nvm/versions/node/v6.5.0/lib/node_modules/nodemon/node_modules/chokidar/index.js:151
async remove(item) {
^^^^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:528:28)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/SI23/.nvm/versions/node/v6.5.0/lib/node_modules/nodemon/lib/monitor/watch.js:6:16)
at Module._compile (module.js:556:32)
Any way to fix this?
As per my knowledge
Async Await is not available in node v6.5.0,
which you are using. So you can upgrade your node version or can start using Promise object with the same version of node.
In my case, npm list chokidar helped me realize it was another module (gulp-nodemon) that used a newer version of chokidar. It worked after downgrading it.
I had exactly the same error...! it was a node version problem, I was on node version 6, this is what I did to fix it:
nvm install <VERSION_NUMBER> // nvm install 10.15.3
nvm use <VERSION_NUMBER> // nvm use 10.15.3
node -v // confirm i am using the correct version of node
Remember to do this on your computer not just your code file and change the default node version with nvm alias default 10.15.3
you can check your default lists with
nvm list

SyntaxError: Unexpected token ... in node_modules/express-validator/lib/express_validator.js:75

I am trying to run my project with node server.js and i am getting following error.
/Library/WebServer/Documents/PROJECT/node_modules/express-validator/lib/express_validator.js:75
chain[name] = (...options) => {
^^^
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Library/WebServer/Documents/PROJECT/node_modules/express-validator/index.js:1:80)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
I am using Express.js framework. It was working fine last time when i worked on it.
After searching a lot i finally found that for one of my project which was build with nodejs older version i was using node#4.4.7 and after changing node version on my local machine with following:
nvm ls // to check out what versions of Node.js are installed on your machine
-> v4.4.7
v8.9.1
system
default -> 4.4.7 (-> v4.4.7)
To switch Node.js from node#4.4.7 to node#8.9.1 i have used following command:
nvm use v8.9.1
To verify i check again with nvm ls and now it shows.
v4.4.7
-> v8.9.1
system
default -> 4.4.7 (-> v4.4.7)
Yes the spread operator which is available in ES6 will be available form versions 8 and above for node 8 .

Installation Error ("Unexpected error when typed "heroku" ")

I am trying to install heroku CLI using this command "wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh"
Eveything seems to be going at first. But after completition when i type "heroku --version", following error pops up.
/usr/local/lib/node_modules/heroku-cli/bin/run:12
const {run} = require('#cli-engine/engine')
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
I don't have any idea how to proceed. I have searched the internet to my capabilities and still unable to find a solution.
I have tried installing using "npm install -g heroku-cli" but still getting the same error.
Any help will be appreciated.
Thanks!
heroku-cli requires a minimum node version of 6.15.24. Upgrade your node. The latest stable version of node is 8.9.4

Use of const in strict mode-React native project

Getting this error while initiating react native project im using ubuntu 14.04 i have tried with root access also and updated node version.help to solve the problem
/usr/local/lib/node_modules/react-native-cli/index.js:266
const rnPackage = options.version;
^^^^^
SyntaxError: Use of const in strict mode.
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 Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
FYR
root#syscon-ThinkCentre-E73:~# node -v
v0.10.25
root#syscon-ThinkCentre-E73:~# nodejs -v
v0.10.25
root#syscon-ThinkCentre-E73:~# npm -v
1.3.10
syscon#syscon-ThinkCentre-E73:~$ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
You need node >= 4 for latest version of react-native-cli : https://github.com/facebook/react-native/blob/master/react-native-cli/package.json#L8
You can check the required version in /usr/local/lib/node_modules/react-native-cli/package.json

node 0.12.x const in strict mode issue

I'm running node v0.12.7, and installed protractor through npm.
Now I'm trying to run the conf.js using this simple tutorial, and I get the following error when executing the command protractor conf.js:
[launcher] Process exited with error code 1
C:\Users\ramtin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:25
const builder = require('./builder');
^^^^^
SyntaxError: Use of const in strict mode.
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> (C:\Users\ramtin\AppData\Roaming\npm\node_modules\protractor\built\protractor.js:3:17)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Can't update node due to dependency issues it will produce (I'm working on an already-built project which used node 0.12.17).
Using --harmony flag on protractor doesn't work. Do I need to install a specific version of protractor to be compatible with node 0.12.7? Or should I use babeljs to compile ES6 to ES5?
If babeljs is the answer, how would I use it for protractor?
Do I need to install a specific version of protractor to be compatible with node 0.12.7
You need protractor version 2.
From https://github.com/angular/protractor#compatibility

Resources