Updating react typings; Unable to find 'react' in the registry - reactjs

I noticed my react typings dont seem to be the right version, ie #types/react (15.0.35) but using react (15.6.1) in my project so I'm trying to update the typings. I tried:
typings install react#15.6.1
but got the err: Unable to find 'react' ('npm') in the registry
I'd like to update the typings to the version of react that I'm using (15.6.1) not to the latest typings, and I don't really want to update my project to the latest version of react.

Please stop using typings it's deprecated https://github.com/typings/typings as you can see in the github project.
Please use #types scope...
npm install --save #types/react#15.6
If you have problems using this approach please show your tsconfig.json

Related

React18 is not supporting styled-component

Can anyone help me out to solve this problem.
As I am learning React Native, I was going through styled components but was facing an error related to styled components not compatible with react18 version. and same works in react#16 and below
I was trying to install styled-components for styling components in react-native. And i was receiving error saying that react18 is not compatible. I just want styled components to work
Try to install it with this command
npm install styled-components --force
I sorted the solution as styled-component was not working for react 18.0.2.
So I decided to uninstall react 18.0.2 by using npm uninstall react#18.0.2
and then
I reinstalled npm install react#17.0.2 and then I read the documentation of Styled Component
and installed styled-components using yarn add styled-components and successfully sorted out my problem.
npx expo install react-dom
This fixed it for me (using expo managed react-native app)
https://github.com/styled-components/styled-components/issues/3788#issuecomment-1335191911
I had same problem when taking Udemy course about React Native. This course provides git with complete code, so what I did was:
Downloaded packages.json file from git url provided with course (last version),
Deleted my project node_modules folder,
Deleted my project packages-lock.json file,
Executed npm install

Is it a problem if #types/react and react have different versions?

Typescript is added to the version 16 react application created with create react app.
I have installed the latest v.18 version of #types/react and #types/react-dom, but I would like to know if it is a problem that the version is different from react.
Thank you.
npx typesync will resolve type syncing issues. The script checks your package.json and searches the web for the #types version of your package, if one is not already installed. This may also remove the #types packages should you no longer need it.
You can go a step further and add this in your package.json:
“postinstall”: “npx typesync”
Now every time you install or update your packages you’ll automatically run the postinstall script!
Yes, as you'll have TS types for React 18, but JS code for React 16. For example, you may be able to import a new feature from React 18 but get a runtime error because you only have React 16.
You can solve this by using #types/react and #types/react-dom version 16 until you're ready to upgrade to React 18.

How to add Tradingview's Lightweight-charts to React Typescript

I tried installing Tradingview's 'lightweight-charts' for react typescript but I can't seem to download the #types for this package because it does not show up on package.json. Therefore, unable to render my react app.
I have tried installing with npm and yarn but they both don't work
Can anyone please help me?
Where can I download the types for this package so it works? The npm repository says that it supports typescript.
thanks in advance!
As part of our package, we generate and provide types that can be found here (for instance).
In theory you shouldn't have to do anything to start working with Typescript as it should work out of the box

How to install missing material-ui files in react

After having installed my material-ui for my react project, but when it comes to use it always bring up an error telling me that
'Module not found'
./src/Components/LatestPost.jsModule not found: Can't resolve#material-ui/lab/Skeleton' in 'C:\Users\Zinox\super-surf\src\Components'
You would have only installed #material-ui/core package which would not include the experimental features you are looking for and hence you are getting the error Module not found: Can't resolve '#material-ui/lab/Skeleton'
To use experimental features of Material UI like Skeleton, Rating, Speed Dial and so on you need to also install the Material UI Lab package,
npm install #material-ui/lab
Note that this is needed in addition to the #material-ui/core package that you installed earlier with npm install #material-ui/core
After installing the above package you could import it as,
import Skeleton from '#material-ui/lab/Skeleton';
in your React Component and use it as desired.
you should add two packages into the app first is
yAR i #material-ui/lab #material-ui/core
Stumbled upon the same issue. Skeleton doesn't seem to be contained in the latest package version (4.0.0-alpha.22) at the moment. But it is on their source folder, which is odd.
Maybe you open an issue at their GitHub.
EDIT:
I did: https://github.com/mui-org/material-ui/issues/16919
Module not found: Can't resolve '#material-ui/lab/Skeleton'
If you want to use Skeleton, Rating, Speed Dial, and so on you need to also install the Material UI Lab package.
npm install #material-ui/lab
or
yarn add #material-ui/lab
Link here.
enter link description here

Module not found: Can't resolve 'material-ui/AutoComplete'

I installed material-ui-search-bar and then I want to use SearchBar.
But I have next problem:
./node_modules/material-ui-search-bar/lib/components/SearchBar/SearchBar.js
Module not found: Can't resolve 'material-ui/AutoComplete' in '...node_modules/material-ui-search-bar/lib/components/SearchBar'
How can I fix it?
AutoComplete is associated with Lab package of material UI. On Adding the "lab" package AutoComplete can be used. Add using yarn
yarn add #material-ui/lab
or using npm
npm install #material-ui/lab
I cannot upvote nor comment, so I just parrot the working solution.
Thanks, #blackspacer.
This works:
npm install #material-ui/lab
One expects all Material UI elements to be present after the initial package install, but there is an exception.
https://material-ui.com/components/about-the-lab/
About the lab
This package hosts the incubator components that are not yet ready to
move to the core.
Installation Install the package in your project directory with:
// with npm
npm install #material-ui/lab
// with yarn
yarn add #material-ui/lab
Install material-ui using this command :
npm install material-ui#latest
This can happen due to multiple reasons.
1) You are using the beta version of v1.0 launch of material-ui which has breaking changes. Try switching to the stable version. Or if you want to use the latest beta version, then use
Refer below link:
https://material-ui-next.com/demos/autocomplete/material-ui AutoComplete
2) Try importing like below:
import AutoComplete from 'material-ui/AutoComplete';
or
import { AutoComplete } from 'material-ui/AutoComplete';
Due to the port going on for #next version the modules are being reorganized and hence few components are breaking.
The only solution that worked is uninstall material-ui-search-bar and install using npm install material-ui-search-bar#beta
Use npm i #autocomplete/material-ui in your terminal.
Then run npm start, issue will be resolved.
import { Autocomplete } from '#autocomplete/material-ui';
Further more information or to try the template on another file for testing - use the below reference link.
[1]:https://www.npmjs.com/package/#autocomplete/material-ui
npm -i #material-ui/core
as more packages may be needed. For me besides lab i also needed utils. Hope this helps.
yarn add material-ui-icons
Try using this in project directory
Install beta version npm install material-ui-search-bar#beta
My issue got resolved after installing beta version.
This question is 4 years old so some of the answers here are no more correct. In 2022 and on v5.5, this is no more a lab component, but another reason you might be still getting this error:
export 'AutoComplete' (imported as 'AutoComplete') was not found in '#mui/material'
is if you're still using the old name. Its name has changed from "AutoComplete" to "Autocomplete", i.e., the letter c is no more capital.
So if you have something like:
import AutoComplete from #mui/material/AutoComplete
...just change it to this:
import Autocomplete from #mui/material/Autocomplete
This is a nice example for your problem try it.
import Tab from '#material-ui/core/Tab'
I guess you are not importing Autocomplete correctly .
For more information Visit here
Import like this.
import Autocomplete from '#material-ui/lab/Autocomplete';

Resources