Use of const in strict mode-React native project - node.js

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

Related

npm create svelte#latest not working correctly on Ubuntu

When I try to use npm create svelte#latest to create a SvelteKit app it won't work when using VS Code with SSH.
The SSH server I'm connected to runs Ubuntu 20.04.2 on 64 bit Intel hardware.
When I try to use npm create svelte#latest . to initialize a SvelteKit project it outputs an error:
import fs from 'fs';
^^
SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Any way to fix this? I would appreciate any help.
You need to update Node. The latest in Ubuntu 20 is v10, which is very outdated. If you're not in a position to update your system to Jammy or Kinetic, you can use nvm another version manager to get yourself up to date. Personally I like n:
npm i -g n
n stable

How to install to latest node version on command prompt or powershell

I am trying to edit a BigCommerce theme using stencilLint. When I type the command:
PS C:\Users\joaom\OneDrive\Desktop\shelfology\cornerstone> stencil init
I get:
PS C:\Users\joaom\OneDrive\Desktop\shelfology\cornerstone> stencil init
C:\Users\joaom\AppData\Roaming\npm\node_modules\#bigcommerce\stencil-cli\lib\cliCommon.js:47
throw new Error(
^
Error: You are running an unsupported version of node. Please upgrade to ^10.17 || ^12
at checkNodeVersion (C:\Users\joaom\AppData\Roaming\npm\node_modules\#bigcommerce\stencil-cli\lib\cliCommon.js:47:15)
at Object.<anonymous> (C:\Users\joaom\AppData\Roaming\npm\node_modules\#bigcommerce\stencil-cli\bin\stencil-init.js:16:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
PS C:\Users\joaom\OneDrive\Desktop\shelfology\cornerstone>
Which is leaving me very confused. I downloaded the latest version of Node from nodejs.org directly, and it still prompts me to get the latest version. Do I have to do this through the command prompt? what would be the command? or what else am I doing wrong?
According to the documentation available here bigcommerce/stencil-cli. Stencil-cli only supports node version 10.x or 12.x. so if you have any other node version switch to either 10 or 12.

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 .

Polymer CLI: SyntaxError: Unexpected strict mode reserved word

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).

Resources