SyntaxError: Unexpected strict mode reserved word - node.js

We have two build agents (Ubuntu 12.04), both have NodeJS 5 and Gulp 3.9 installed:
$ nodejs -v
v5.11.1
$ npm list | grep gulp
├─┬ gulp#3.9.1
But during gulp build - one agent works successfully, and other - return an error:
$ gulp build
/var/lib/go-agent/pipelines/Worker/gulpfile.js:3
let requireDir = require('require-dir');
^^^
SyntaxError: Unexpected strict mode reserved word
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/lib/node_modules/gulp/bin/gulp:19:19)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
What could be wrong here?

Related

npm will not respond at all

no matter what npm package I have, or try and install I keep getting this weird syntax error.
Users/BenNolan/.node/lib/node_modules/npm/lib/cli.js:66
module.exports = async process => {
^^^^^^^
SyntaxError: Unexpected identifier
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/BenNolan/.node/lib/node_modules/npm/bin/npm-cli.js:2:1)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
I have tried updating nvm, npm and node no matter what I try I am still getting the syntax error halfway through the install.

Different Node version Global installation

How can i install two different node version
in this case version 0.10.32 and 8.9.4 (LTS)
when i try using n or nvm to install different version of node and
then used the following command
npm list
i am getting the following error after changing to lower version i.e 0.10.32
/usr/local/lib/node_modules/npm/node_modules/npm-registry-
client/node_modules/npm-package-arg/npa.js:6
let url
^^^
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-
registry-client/lib/access.js:5:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)

Gulp SintaxError : Unexpected identifier

I try to edit a Gulp app on my local server.
I thought it could something with ES6 or version, but I tried so hard and nothing.
I always have this error:
/var/www/html/carros/gulpfile.js:11
let dev = true;
^^^
SyntaxError: Unexpected identifier
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 Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3)
at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:198:16)
at module.exports (/usr/local/lib/node_modules/gulp/node_modules/liftoff/node_modules/flagged-respawn/index.js:17:3)
at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:190:9)

Can not run webdriver manager

When i run
vegan#vegan:~/xx-xx/gateway$ webdriver-manager start /usr/lib/node_modules/protractor/node_modules/webdriver-manager/built/lib/cli/logger.js:66
info(...msgs) {
^^^
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object. (/usr/lib/node_modules/protractor/node_modules/webdriver-manager/built/lib/cli/index.js:8:10)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
i got error. It started when protractor doesnot run.
the error was that
Protractor error selenium spring boot
but this time updating version, did not work. So i did npm install, bower gulp install after i deleing node module file.
now for gulp run ( i use gulp to run protractor), i got this
> gulp protractor prod [15:47:58] Using gulpfile
> ~/xx-xx/gateway/gulpfile.js [15:47:58] Starting 'protractor'...
> [15:47:58] Starting 'prod'... [15:47:58] Finished 'prod' after 547 μs
> Using ChromeDriver directly... [launcher] Running 1 instances of
> WebDriver [launcher] Error: SyntaxError: Unexpected token ...
> at exports.runInThisContext (vm.js:53:16)
> at Module._compile (module.js:387:25)
> at Object.Module._extensions..js (module.js:422:10)
> at Module.load (module.js:357:32)
> at Function.Module._load (module.js:314:12)
> at Module.require (module.js:367:17)
> at require (internal/module.js:20:19)
> at Object.<anonymous> (/home/vegan/xx-xx/gateway/node_modules/jasminewd2/index.js:7:17)
> at Module._compile (module.js:413:34)
> at Object.Module._extensions..js (module.js:422:10) [launcher] Process exited with error code 100 [15:47:59] gulp-notify: [JHipster
> Gulp Build] Error: protractor exited with code 100 [15:47:59] Finished
> 'protractor' after 1.19 s [15:47:59] E2E Tests failed
UPDATE
i deleted all node modules and did npm install again. Now when i do
**webdriver-manager it gives errors
**
webdriver-manager
/usr/lib/node_modules/protractor/node_modules/webdriver-manager/built/lib/cli/logger.js:66
info(...msgs) {
^^^
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/protractor/node_modules/webdriver-manager/built/lib/cli/index.js:8:10)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)**
**
or for **webdriver-manager update
** same
It's due to you are using an older version of node. Please update your node version to min. 6.9.x and try it would certainly work.

How to build npm package from source

I'm new to npm/node and I'm trying to build this repository:
https://github.com/react-component/slider
After clone and run npm install, I get this error:
/Users/rodrigora/Projects/slider/node_modules/rc-server/lib/index.js:39
app.get('/tests/runner.html', 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> (/Users/rodrigora/Projects/slider/node_modules/rc-server/bin/start.js:3:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
I've reinstalled node/npm, deleted node_modules folder but nothing worked.
$ node -v
v0.12.0
$ npm -v
3.5.2
I don't have a clue how to fix it. Any help?

Resources