Different Node version Global installation - node.js

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)

Related

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)

Ubuntu Phonegap Error while creating app

/usr/local/lib/node_modules/phonegap/lib/phonegap/util/connect-proxy.js:21
fs.readFile(settings, (err, data) => { ^SyntaxError: Unexpected token >
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/phonegap/lib/phonegap/serve.js:9:23)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
It means that the version of Node that you're sing doesn't support the arrow function syntax.
Which is strange because it must be 0.12 or older - which is not maintained any more and should be upgraded. The current version is 7.5.0, the latest LTS version is 6.9.5 (as of February 2017). Versions older than 4.x should not be used for anything.
For more info see:
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions
For Node versions compatibility with arrow function syntax see:
http://node.green/#arrow-functions
For Node versions support schedule see:
https://github.com/nodejs/LTS#lts-schedule

SyntaxError: Unexpected strict mode reserved word

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?

'The specified module could not be found' error when using 'scrypt' module in node.js

I'm trying to use 'scrypt' module. The problem is that when I try to run my nodejs application (node app.js), I get this error:
C:\Users\A\Documents\B\C>node app.js
module.js:356
Module._extensions[extension](this, filename);
^
Error: The specified module could not be found.
C:\Users\A\Documents\B\C\node_modules\scrypt\build\Release\scry
pt.node
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> (C:\Users\A\Documents\B\C\node_module
s\scrypt\index.js:1:76)
at Module._compile (module.js:456:26)
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)
I installed 'scrypt' module with this line:
npm install scrypt -msvs_version=2012
the -msvs_version is taken from this answer
You should have a look at this node-scrypt issue.
According to what is said there, you should be able to solve your problem by
either installing OpenSSL for Windows
or installing and building with Visual Studio 2010

Error: Module version mismatch. Expected 11, got 1

module.js:356
Module._extensions[extension](this, filename);
^
Error: Module version mismatch. Expected 11, got 1.
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> (/home/awd/html/node_modules/canvas/lib/bindings.js:2:18)
at Module._compile (module.js:456:26)
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)
Update your npm packages first - this error is thrown usually when you switch node.js version, but did not update dependencies. To update it:
npm update

Resources