create-react-app

isolatedModules error on Jest test with Create React App and TypeScript?

五迷三道 提交于 2020-07-18 09:24:36
问题 I've started a Create React App project with --typescript. When I write a test Im getting a compiler error: // something-test.tsx test('something', ()=>{ expect(1).toBe(1) }) The error is: TS1208: All files must be modules when the '--isolatedModules' flag is provided. From googling I thought the fix was to create a jest.config.tsx with: module.exports = { roots: ["<rootDir>/src"], transform: { "^.+\\.tsx?$": "ts-jest" }, testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",

cannot import image with create-react-app

心已入冬 提交于 2020-07-18 03:35:20
问题 I'm using create-react-app , and I am struggling to load images. I am following the instructions as specified here, but I keep seeing the following error: Failed to compile. Error in ./src/components/Home/imageIndex.ts (1,24): error TS2307: Cannot find module './party.png' Does anyone know why when I run yarn start my app continues to fail to compile? I have a Home component and this is how I am importing the file: import photo from './party.png'; The component is located in src/components

ENOSPC Error in create-react-app

a 夏天 提交于 2020-07-17 11:10:20
问题 create-react-app error I get this error message when I run yarn start from my terminal... I've tried sudo killall node and many other process to clear the i-node yet no success. I have also downgraded my create-react-app version to version 1.5.1 and yet I still have these errors... Please can anyone help out? 回答1: You're most likely hitting the Unix limit of how many files a process can watch. The following command should help: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl

Create React App not working

半城伤御伤魂 提交于 2020-07-17 07:30:18
问题 Help! I have no idea what is going on here, create react app is not working I have also tried reinstalling and yet to no avail, please help! Npm version: 5.4.2 Node version: 8.70 Tried the npm install --save --save-exact --loglevel error react react-dom react-scripts 回答1: Please try this: npm cache clean --force 回答2: In my case, "create-react-app" was not installed. to install run this command npm install -g create-react-app Once installation successful, try running npx create-react-app hello

React: Deep requiring is deprecated as of uuid, Please require the top-level module

拜拜、爱过 提交于 2020-07-09 04:29:08
问题 my React app successfully shows the button however receiving this error. index.js:1 Deep requiring like const uuidv4 = require('uuid/v4'); is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser import React, { Component } from 'react'; import { Container, ListGroup, ListGroupItem, Button } from 'reactstrap'; import { CSSTransition, TransitionGroup } from 'react-transition-group'; import

React: Deep requiring is deprecated as of uuid, Please require the top-level module

淺唱寂寞╮ 提交于 2020-07-09 04:28:47
问题 my React app successfully shows the button however receiving this error. index.js:1 Deep requiring like const uuidv4 = require('uuid/v4'); is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser import React, { Component } from 'react'; import { Container, ListGroup, ListGroupItem, Button } from 'reactstrap'; import { CSSTransition, TransitionGroup } from 'react-transition-group'; import

React: Deep requiring is deprecated as of uuid, Please require the top-level module

大憨熊 提交于 2020-07-09 04:28:07
问题 my React app successfully shows the button however receiving this error. index.js:1 Deep requiring like const uuidv4 = require('uuid/v4'); is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser import React, { Component } from 'react'; import { Container, ListGroup, ListGroupItem, Button } from 'reactstrap'; import { CSSTransition, TransitionGroup } from 'react-transition-group'; import

npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)

 ̄綄美尐妖づ 提交于 2020-07-05 03:25:10
问题 When I want to create a react app I'm encountering the following error: npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms) npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\info\AppData\Roaming\npm-cache\_logs\2020-04-23T02_54_45_865Z-debug.log Aborting installation. npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed. Deleting generated file... package.json Deleting app2/

React-Intl how to switch locale and messages from variable

感情迁移 提交于 2020-07-04 11:54:47
问题 I'm trying to figure out how to change language using React-Intl. This is my first React App and it has been made with create-react-app, I'm not using Redux nor Flux. In my index.js I have the following code: import React from 'react'; import ReactDOM from 'react-dom'; import TodoApp from './components/TodoApp'; import registerServiceWorker from './registerServiceWorker'; import './index.css'; // Bootstrap CSS libraries import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap/dist/css

React-Intl how to switch locale and messages from variable

可紊 提交于 2020-07-04 11:53:59
问题 I'm trying to figure out how to change language using React-Intl. This is my first React App and it has been made with create-react-app, I'm not using Redux nor Flux. In my index.js I have the following code: import React from 'react'; import ReactDOM from 'react-dom'; import TodoApp from './components/TodoApp'; import registerServiceWorker from './registerServiceWorker'; import './index.css'; // Bootstrap CSS libraries import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap/dist/css