Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update core-js to core-js@3 dependency?

While I was trying to install and setup react native, the precaution observed about the core-js version as update your core-js@... to core-js@3 But don't know how to update my core-js.

$ sudo react-native init AwesomeProject121 Password: This will walk you through creating a new React Native project in /Users/amarnr1989/AwesomeProject121 Using yarn v1.13.0 Installing react-native... yarn add v1.13.0 info No lockfile found. [1/4] 🔍  Resolving packages... warning react-native > create-react-class > fbjs > [email protected]: core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2. [2/4] 🚚  Fetching packages... [----------------------------------------------------------------------------------------------------------------------------------------------------------] 0/601internal/modules/cjs/loader.js:584     throw err;     ^  Error: Cannot find module '/Users/amarnr1989/AwesomeProject121/node_modules/react-native/package.json'     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)     at Function.Module._load (internal/modules/cjs/loader.js:508:25)     at Module.require (internal/modules/cjs/loader.js:637:17)     at require (internal/modules/cjs/helpers.js:22:18)     at checkNodeVersion (/usr/local/lib/node_modules/react-native-cli/index.js:306:21)     at run (/usr/local/lib/node_modules/react-native-cli/index.js:300:3)     at createProject (/usr/local/lib/node_modules/react-native-cli/index.js:249:3)     at init (/usr/local/lib/node_modules/react-native-cli/index.js:200:5)     at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:153:7)     at Module._compile (internal/modules/cjs/loader.js:701:30) 

Please Suggest

like image 989
Amar Avatar asked Apr 10 '19 07:04

Amar


People also ask

What is the latest version of Core JS?

core-js v3. 25.3. Modular standard library for JavaScript. Includes polyfills for ECMAScript up to 2023: promises, symbols, collections, iterators, typed arrays, many other features, ECMAScript proposals, some cross-platform WHATWG / W3C features and proposals like URL .

Why is core JS used?

The Core JavaScript Framework or "CoreJS" is a client-side JavaScript library which provides tools for creating object-oriented and event-driven JavaScript code. It is used by the Echo3 Framework but is not in any way dependent upon it (CoreJS is designed be used independently).


2 Answers

You update core-js with the following command:

npm install --save core-js@^3 

If you read the React Docs you will find that the command is derived from when you need to upgrade React itself.

like image 130
Chiaro Avatar answered Sep 19 '22 16:09

Chiaro


For npm

 npm install --save core-js@^3 

for yarn

yarn add core-js@^3 
like image 38
Parveen Chauhan Avatar answered Sep 16 '22 16:09

Parveen Chauhan