Home > Mobile >  I cant install react native
I cant install react native

Time:09-21

How can I fix this ? when I install something in react native , VC code shows that error , is it a big problem ?

pm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types/react-native-simple-alarm - Not found
npm ERR! 404
npm ERR! 404  '@types/react-native-simple-alarm@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\User\AppData\Roaming\npm-cache\_logs\2021-09-21T05_47_59_621Z-debug.log

CodePudding user response:

From that error it seems that you are installing Typescript declaration files.

@types prefixes are dedicated typings for Typescript, it's a repository for typescript declaration files (you can read more in DefinitelyTyped).

If you're using typescript to compile your react-native codes, then you should worry as you'll see a lot of compilation issues if the library you used does not support typescript out-of-box. You have a choice to either write a dedicated d.ts to support it or if you're nice you can contribute to @types/ so others can use. :)

Simply to say, react-native-simple-alarm doesn't seem to have a dedicated files in @types, nor from source code does it support typescript out on it's own. If you ran

npm install @types/react-native-simple-alarm

you'll get exception as the library does not exist in react NPM screenshot

And on click on which, it would take you to the package's TypeScript Definitions package, here @types/react NPM screenshot

CodePudding user response:

all npm libraries are not supported in React Native. Here is the official lists of libraries allowed in react native:- https://reactnative.directory/

don't take/search react native libraries at "https://www.npmjs.com/", search it in "https://reactnative.directory/".

  • Related