orYoffe/create-react-native-web-app

Error when creating app using create-react-native-web-app

Closed this issue ยท 4 comments

Running the command to create a new project ends up creating a project with no web support.

Error is as follows, looks like the package is missing from the registry.

info Fetching template react-native-template-react-native-template-react-native-web...
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/react-native-template-react-native-template-react-native-web - Not found
npm ERR! 404
npm ERR! 404 'react-native-template-react-native-template-react-native-web@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.

Hi @sreeraj-wd
Any chance that you might have react-native-cli or create-react-native-web-app globally?

In that case please uninstall globally so that the latest version of this package will be used by npx as well as react-native-cli

@orYoffe
Thanks . that worked.
Now I have A number of babel errors saying 'Support for the experimental syntax 'xxx' isn't currently enabled'

Example:
./node_modules/react-native-vector-icons/lib/create-icon-set.js
SyntaxError: /home/sreeraj/test/myApp/node_modules/react-native-vector-icons/lib/create-icon-set.js: Support for the experimental syntax 'classProperties' isn't currently enabled (43:10):

This Got anything to do with this package??

That's because the libraries that are aimed for react native are es6 and need to go through webpack to be compiled by babel-loader

Basically you need to use craco or another npm package that can change create-react-app project's webpack config to include these libraries.

Please raise another issue for this if the issue continues since it's a different topic

@sreeraj-wd here is an example of what i meant using the craco package
https://github.com/orYoffe/rn-nav/blob/main/craco.config.js