Phoenix Phoenix
Phoenix Phoenix

Reputation: 89

Created new React app and message appeared says "babel-preset-react-app" is important

I created a new React app using npx and and when I started the app using npm start a message appeared:

One of your dependencies, babel-preset-react-app, is importing the "@babel/plugin-proposal-private-property-in-object" package without declaring it in its dependencies. This is currently working because "@babel/plugin-proposal-private-property-in-object" is already in your node_modules folder for unrelated reasons, but it may break at any time.

babel-preset-react-app is part of the create-react-app project, which is not maintianed anymore. It is thus unlikely that this bug will ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to your devDependencies to work around this error. This will make this message go away.

What should I do?

Upvotes: 0

Views: 4643

Answers (1)

Christian_M
Christian_M

Reputation: 51

npm install @babel/plugin-proposal-private-property-in-object --save-dev

npm stands for node package manager, and helps to manage all of the dependencies, or other code files, that the application you are building relies on. It keeps track of these in a file called package.json.

In package.json, dependencies and their versions are listed as the values for the keys "dependencies" and "devDependencies". The production build of your application will use "dependencies" but ignore "devDependencies", while the development build will use both.

If you would like to add a package to "devDependencies", you run:

npm install [package_name] --save-dev

where "--save-dev" tells npm this goes in "devDependencies". If you want to install for your production application, simply run:

 npm install [package_name]

You can read more about the difference between the two here, and information on other commands that interact with this concept here. If you would like to read about the difference between 'npx' and 'npm' read here. If you want to read about why Create React App is unsupported and why, read this comment here. To find a list of currently recommended frameworks for React, go here

Upvotes: 1

Related Questions