React.Js styled-components getting this error - reactjs

ERROR in ./src/components/Login.js 4:0-39
Module not found: Error: Cannot find file:
'styled-components.browser.esm.js' does not match the corresponding
name on disk:
'.\node_modules\styled-Components\dist\styled-components'.

This looks like an installation problem. Run/type in command line
npm install --save styled-components
and then restart your app, by running npm start
If you use yarn, replace npm with yarn.
Let us know if the issue resolves!

Related

Could not install from "#mui\material\generateUtilityClass" as it does not contain a package.json file

I am unable to install #mui\material\generateUtilityClass library for my React application.
On running npm install #mui\material\generateUtilityClass, I am receiving the following error:
Could not install from "#mui\material\generateUtilityClass" as it does not contain a package.json file.
On running yarn add #mui\material\generateUtilityClass, receiving the following error:
An unexpected error occurred: "https://registry.yarnpkg.com/#mui%2fmaterial/generateUtilityClass: Request "https://registry.yarnpkg.com/#mui%2fmaterial/generateUtilityClass" returned a 405"
The following libraries need to be installed: #mui/lab and #mui/material
yarn add #mui/lab #mui/material
More: https://mui.com/material-ui/about-the-lab/

npm ERR! Unexpected end of JSON input while parsing near '...grity":"sha512-kyAaTj'

While I was trying to install dependencies related to firebase in my react app, I ran npm install --save firebase but it resulted in an error. All other packages required for my app is installed properly except this. What could be the problem with this particular package?
I have attached the snippet of the error below

How can i correct the error i keep getting in creating a react app

Each time i tried creating a react app using create-react-app <...name> i keep getting this error "
Creating a new React app in C:\windows\system32\brian-todos.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Unexpected end of JSON input while parsing near '...tXcMskoaoOolrubJ3NQGh'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\BrianMartinez\AppData\Roaming\npm-cache_logs\2019-01-12T13_11_25_580Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting brian-todos / from C:\windows\system32
Done."
I even tried npm clear cache it still didn't not work.What do i do about this challenge
It seems you opened your windows console or powershell as an administrator, and you landed in system32 folder. Don't create your project there, that is a reserved folder for system executables. Do something like cd C:\Users\yourusername\Documents and try there.
This is the answer to the challenge i had before now. follow these steps
npm install -g yarn
yarn global add create-react-app
create-react-app

Webpack-hot-middleware/client module not found

So im getting this error in the terminal ERROR in multi ./client/src/index.js webpack-hot-middleware/client
Module not found
I am not sure why because in my project this file is there. I tried the npm install --save command but that didn't change anything. Any help appreciated
Try this steps
npm cache clean
npm i webpack-hot-middleware --save-dev

Installing es6-promise with typings

I was reading this article on Angular 2 - https://semaphoreci.com/community/tutorials/setting-up-angular-2-with-webpack
* the above article is for Angular 2 RC5.
All works smoothly until the time we get to executing this line - installing es6-promise with typescript (typings).:
./node_modules/.bin/typings install es6-promise --save
Executing this line in Terminal throws the following error:
typings WARN hastypings Typings for "es6-promise" already exist in "node_modules/es6-promise/es6-promise.d.ts". You should let TypeScript resolve the packaged typings and uninstall the copy installed by Typings
typings ERR! message Unable to find "es6-promise" ("npm") in the registry.
typings ERR! message However, we found "es6-promise" for 2 other sources: "common" and "dt"
It looks like you already have typings installed with the module, so there is no need еo do it manually. Try just to skip this step - ./node_modules/.bin/typings install es6-promise --save
I just had this same issue
The command has been changed to:
typings install dt~es6-shim --save --global
You can check this github issue for reference:
Unable to install es6 Shim or registry:env/meteor
This will work for you:
./node_modules/.bin/typings install es6-promise --source dt --save
It will import for you the requested file from DefinitelyTyped.
With the typings repo being deprecated, you would now use the following command:
npm install #types/es6-shim --save

Resources