Get version number from package.json in React Redux (create-react-app)

Solving this without importing and exposing package.json to the create-react-app Requires: version 1.1.0+ of create-react-app .env REACT_APP_VERSION=$npm_package_version REACT_APP_NAME=$npm_package_name index.js console.log(`${process.env.REACT_APP_NAME} ${process.env.REACT_APP_VERSION}`) Note: the version (and many other npm config params) can be accessed Note 2: changes to the .env file will be picked only after you restart the development server

Jest + Typescript + Absolute paths (baseUrl) gives error: Cannot find module

I was struggling with the same problem and actually it turns out that a simple change seems to do the trick. I just updated the moduleDirectories field in jest.config.js. Before moduleDirectories: [‘node_modules’] After moduleDirectories: [‘node_modules’, ‘src’] Hope it helps.

‘TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined’

To fix this issue simply upgrade react-scripts package (check latest version with npm info react-scripts version): Replace in your package.json “react-scripts”: “^3.x.x” with “react-scripts”: “^3.4.1” (or the latest available version) (optional for some) Delete your node_modules folder Run npm install or yarn install Some people reported that this issue was caused by running npm audit … Read more

Home does not contain an export named Home

The error is telling you that you are importing incorrectly. Here’s the code you have to add: import { Home } from ‘./layouts/Home’; This is incorrect because you’re exporting as the default export, not as a named export. Check this line: export default Home; You’re exporting as default, not as a name. Thus, import Home … Read more

Line 0: Parsing error: Cannot read property ‘map’ of undefined

Edit: as noted by Meng-Yuan Huang, this issue no longer occurs in react-scripts@^4.0.1 This error occurs because react-scripts has a direct dependency on the 2.xx range of @typescript-eslint/parser and @typescript-eslint/eslint-plugin. You can fix this by adding a resolutions field to your package.json as follows: “resolutions”: { “**/@typescript-eslint/eslint-plugin”: “^4.1.1”, “**/@typescript-eslint/parser”: “^4.1.1” } NPM users: add the … Read more