Questions tagged [react-scripts]

Package containing various scripts for running applications created via create-react-app

Package containing various scripts for running applications created via create-react-app

501 questions
4
votes
1 answer

Coverage report for jest unit tests not displaying with --coverage option

My Project is based on Create-react-app setup and my package.json script for testing unit tests is as below "scripts": { "test": "react-scripts test --coverage", } or "test": "react-scripts test --coverage…
Shrikant Dande
  • 223
  • 1
  • 5
  • 17
4
votes
1 answer

react-scripts test raises TypeError unrelated to the component being tested

I'm testing a component that uses ag-grid, but the test suite fails on import of the license of it, and it's unrelated to the component being tested. import React from 'react'; import RelatorioVendas from './RelatorioVendas'; import { configure,…
Ericson Willians
  • 7,606
  • 11
  • 63
  • 114
4
votes
5 answers

React scripts start is giving Unexpected token error

I have been using create-react-app to bootstrap react apps all this while. But I am facing a really strange issue today. After bootstrapping my app with create-react-app. I am facing the below issue after I run npm…
A.K.47
  • 237
  • 2
  • 12
4
votes
4 answers

How to make Visual Studio 2017 call the `yarn start`

I have a React project, and I run it with yarn start that runs react-scripts start. I want to use Visual Studio 2017 to edit code and run the app, but I don't want to run using the VS2017 node.js things, I want to hit F5 and continue using the…
lmcarreiro
  • 5,312
  • 7
  • 36
  • 63
4
votes
1 answer

After running npm start command line doesn't work

I'm hoping others have had this issue before.. I used npm start in the terminal to run my react project which opens through localhost:3000 fine, but then any following commands I write in the terminal don't execute! I want to be able to use…
BJones100
  • 57
  • 1
  • 7
4
votes
1 answer

"Error: spawn git ENOENT" when running react-scripts test

I have a project that I created using the create-react-app. When I first created the project the tests ran fine. I decided to run the tests after not running them for a while (I still haven't written any so the generated test class is all I have)…
Matt Watson
  • 5,065
  • 4
  • 30
  • 48
4
votes
1 answer

react-snapshot: addComponentAsRefTo(...) error

Following this tutorial: https://medium.com/superhighfives/an-almost-static-stack-6df0a2791319 Getting this error after application is being built: facebook-react-error: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding…
vvinton
  • 121
  • 1
  • 5
3
votes
1 answer

Running `react-scripts build` fails, but there is no output about what went wrong

I have an NPM script for building react application written like this "build": "react-scripts build". When I run npm run build the following (incomplete) directory structure is created: build |-- images |-- manifest.json After some time the command…
Karolis
  • 255
  • 3
  • 15
3
votes
0 answers

"Module not found: Error: Can't resolve" in React app

I get this error displayed 4 times in my React App: Module not found: Error: Can't resolve 'PATH\app2\node_modules\source-map-loader\dist\cjs.js' in 'PATH\app2' When I checked the node_modules file, I saw that there is no source-map-loader file. I…
3
votes
1 answer

TypeError: Failed to load plugin 'jest' declared in '.eslintrc': Class extends value undefined is not a constructor or null

I was updating react-scripts to latest version i.e. 5.0.0 and started seeing above error. One article suggested to upgrade @typescript-eslint to version ^5.0.0 in order to be compatible with eslint version ^8.3.0 which comes by default by updating…
3
votes
1 answer

Add webpack plugins through config-overrides.js

I'm using react app with customized configuration without ejecting and for that I'm using react-app-rewire. To provide plugins to webpack, I used react-app-rewire-provide-plugin. After updating my react-scripts to the latest version the…
3
votes
1 answer

Should not import the named export 'name' (imported as 'packageName') from default-exporting module (only default export is available soon)

Getting this error on upgrading react-scripts from 3.4.1 to ^5.0.0. I have checked in code, import and export statements seems fine and not importing package.json in any file, but could not able to build it. Should not import the named export…
Ram's
  • 111
  • 1
  • 1
  • 12
3
votes
0 answers

NPM build with version number

Is there a way to update the version number of my react app package.json version variable via command line? Maybe with npm build or before/after npm build? I have a build server that will run npm build and then deploy to production. I want to be…
Christopher Townsend
  • 1,527
  • 1
  • 13
  • 37
3
votes
0 answers

Using @availity with react-scripts: "Support for the experimental syntax 'jsx' isn't currently enabled"

When I try to import a component from @availity, I get a compiler error: Failed to compile. ./node_modules/@availity/form/src/Checkbox.js SyntaxError: /home/admin/node_modules/@availity/form/src/Checkbox.js: Support for the experimental syntax…
Lord Elrond
  • 13,430
  • 7
  • 40
  • 80
3
votes
2 answers

how to fix Regular Expression Denial Of Services in react script

I got 86 vulnerabilities and 4 of them are high. And then I run npm audit to know what's wrong with my react project High Regular Expression Denial of Service Package normalize-url Patched in >=4.5.1 <5.0.0 || >=5.3.1…
Yustina Yasin
  • 147
  • 2
  • 12