Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install react-scripts without postcss

I'm trying to upload my code onto a server but it won't allow me because of moderate vulnerabilities. I've narrowed down my issue to an old version postcss downloaded from installing react app, specifically react-scripts. I've tried uninstalling postcss and react-scripts then installing postcss first, but whenever I do the installation it installs a bad version in its dependencies on node-modules folder.

Log of some of the errors in case my issues without postcss

 Moderate        Regular Expression Denial of Service                          
  Package         postcss                                                       
  Patched in      >=8.2.10                                                      
  Dependency of   react-scripts                                                 
  Path            react-scripts > postcss-preset-env > postcss-place > postcss  
  More info       https://npmjs.com/advisories/1693                             

  Moderate        Regular Expression Denial of Service                          
  Package         postcss                                                       
  Patched in      >=8.2.10                                                      
  Dependency of   react-scripts                                                 
  Path            react-scripts > postcss-preset-env >                          
                  postcss-pseudo-class-any-link > postcss                       
  More info       https://npmjs.com/advisories/1693                             

  Moderate        Regular Expression Denial of Service                          
  Package         postcss                                                       
  Patched in      >=8.2.10                                                      
  Dependency of   react-scripts                                                 
  Path            react-scripts > postcss-preset-env >                          
                  postcss-replace-overflow-wrap > postcss                       
  More info       https://npmjs.com/advisories/1693  

Log of my uninstall/reinstall to show its the react-scripts

found 79 moderate severity vulnerabilities in 1994 scanned packages
  79 vulnerabilities require manual review. See the full report for details.
PS C:\Users\pet22\JavaScriptProjects\skp-forum\front> npm uninstall react-scripts
removed 1839 packages and audited 152 packages in 17.069s

10 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

PS C:\Users\pet22\JavaScriptProjects\skp-forum\front> npm i react-scripts        
npm WARN deprecated [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
npm WARN deprecated @hapi/[email protected]: Switch to 'npm install joi'
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/[email protected]: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

> [email protected] postinstall C:\Users\pet22\JavaScriptProjects\skp-forum\front\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> [email protected] postinstall C:\Users\pet22\JavaScriptProjects\skp-forum\front\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> [email protected] postinstall C:\Users\pet22\JavaScriptProjects\skp-forum\front\node_modules\ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.3 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @babel/[email protected] requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer 
dependencies yourself.

+ [email protected]
added 1839 packages from 659 contributors and audited 1994 packages in 57.301s

139 packages are looking for funding
  run `npm fund` for details

found 79 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

npm audit fix does nothing for me.

Question: How do I install react-scripts without installing postcss lower than 8.2.10?

like image 410
the-hyphen-user Avatar asked May 11 '21 00:05

the-hyphen-user


People also ask

What is npm install react-scripts?

react-scripts are simply scripts to run the build tools required to transform React JSX syntax into plain JavaScript programmatically.

Does create react app use PostCSS?

Create React App PostCSS lets you use PostCSS plugins with Create React App 1. x. Once installed, Create React App PostCSS lets you require the PostCSS plugins you want to use right in the code itself. This is the same technique adopted by CodePen, which is powered by the PostCSS Use plugin.

How do you fix react-scripts is not recognized as an internal or external command?

To solve the error "react-scripts is not recognized as an internal or external command, operable program or batch file", open your terminal in your project's root directory and install the react-scripts package by running npm install react-scripts and clear your npm cache if necessary.

Should react-scripts be a dev dependency?

According to NPM dependencies definition, the build dependency, react-scripts , should be a devDependency . However, it is in the dependencies section along with react and react-dom . In fact, react-scripts was a devDependency . For some practical reason, Facebook made it a dependency since react-scripts 1.0.

Can I Create my Own React project without create-react-app?

- DEV Community Creating your React project from scratch without create-react-app: The Complete Guide. Creating and setting up your own React project from scratch can be, at times, a little bit tricky, even though it's not your first time starting a React project.

How to run a react application on JavaScript?

To run your React application, you need to turn your JSX into plain JavaScript, which browsers understand. Create React App (CRA) is a tool to create single-page React applications that is officially supported by the React team.

What does the script do in react?

The script generates the required files and folders to start the React application and run it on the browser. This allows you to focus on coding your application without having to bother with build configurations.

How do I start a react development server using NPM?

Let's start by looking at the start.js script. With the start argument, NPM will begin the process to make a development server available for your React application. Here's a list of tasks for this script: Run the compiler and listen for any messages from Webpack.


Video Answer


1 Answers

I solved the problem for myself temporarily with better npm audit. better npm audit

You have to create some .nsprc file on top level and add the exception according the example (number 1693). Put the audit command into the package.json and maybe change the build script (instead of "npm audit" you should use "npm run audit").

This is not fixing the original issue, but at least builds are not failing anymore.

like image 56
Peer Avatar answered Oct 07 '22 21:10

Peer