Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update getting-started.md #3825

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Juksefantomet
Copy link

Add missing requirement package for freshly installed computers initializing new expo projects

Add missing requirement package for freshly installed computers initializing new expo projects
@netlify
Copy link

netlify bot commented Aug 21, 2023

Deploy Preview for react-native ready!

Name Link
🔨 Latest commit f7de175
🔍 Latest deploy log https://app.netlify.com/sites/react-native/deploys/64e35942ce7b5f000826b389
😎 Deploy Preview https://deploy-preview-3825--react-native.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -23,6 +23,8 @@ Run the following command to create a new React Native project called "AwesomePr
<TabItem value="npm">

```shell
npm i expo-template-blank
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this? Why is it needed?
Also can you share a reference from Expo mentioning that this is needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for any missing clarifications, simply running npx create-expo-app AppName will fail unless you install that package, as it is not automatically resolved. So it simply ends immediately saying it is unable to resolve that package. I figured it would be natural to put that as a pre-requirement to be able to run expo create command.

On a fresh ubuntu 22.04 installation. The only previous installed npm react related packages was normal react and create-react-app usage.

when executing npx create-expo-app AppName, during the first step "Downloading and extracting project files"

Something went wrong in downloading and extracting the project files: NPM package not found: https://registry.npmjs.org/expo-template-blank/-/expo-template-blank-49.0.16.tgz

After installing the pull requested addition, the installation and project initialization continued as expected.

Taking my steps into consideration there might be other issues that were resolved as a result of me installing that package, but ultimately that step failed until i installed the template package prior to the create-expo-app command.

I hope this gave more clarification, if this is something that should be resolved elsewhere if expected to be resolved automatically by create-expo-app then I am all ears.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Simek could check this over?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK the installation of the template package should not be needed, I will rise this issue internally and get back with more information soon.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Juksefantomet, there is a new template version published earlier today on npm (49.0.17). Can you please try creating a new project with that? Also, I'd suggest clearing your npx cache before creating a new project. There could've been an issue with 49.0.16 but we are not sure yet.

Alternatively, you can also try yarn create expo YourProjectName which always fetches the latest template.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I discovered the culprit, these are my steps with the conclusion at the bottom.

First steps:

cache and removal:

npm cache clean --force

npx cache clean --force

reinstalling node and npm

sudo apt-get remove -y nodejs npm && sudo apt-get install -y nodejs npm

Attempted to create-expo-app

largra84@largra84:~/test/tullball$ npx create-expo-app test
✖ Something went wrong in downloading and extracting the project files: NPM package not found: https://registry.npmjs.org/expo-template-blank/-/expo-template-blank-49.0.17.tgz
Error: NPM package not found: https://registry.npmjs.org/expo-template-blank/-/expo-template-blank-49.0.17.tgz
largra84@largra84:~/test/tullball$ npm i expo-template-blank
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs

added 1074 packages in 1m

70 packages are looking for funding
  run `npm fund` for details
largra84@largra84:~/test/tullball$ npm i expo-template-blank^C
largra84@largra84:~/test/tullball$ npm --version
9.8.0
largra84@largra84:~/test/tullball$ node --version
v20.5.1
largra84@largra84:~/test/tullball$ npx --version
9.8.0
largra84@largra84:~/test/tullball$ npx create-expo-app test
✔ Downloaded and extracted project files.
> npm install
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0

added 1222 packages in 7s

70 packages are looking for funding
  run `npm fund` for details


✅ Your project is ready!

To run your project, navigate to the directory and run one of the following npm commands.

- cd test
- npm run android
- npm run ios # you need to use macOS to build the iOS project - use the Expo app if you need to do iOS development without a Mac
- npm run web

current os

largra84@largra84:~/test/tullball$ sudo lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.2 LTS
Release:	22.04
Codename:	jammy

I then realized we are using .npmrc due to our Gemfury private repositories in our organiztion:

~/.npmrc

registry=https://npm-proxy.fury.io/juksefantomet/
//npm-proxy.fury.io/juksefantomet/:_authToken=THAT_awesome_obscured_token
always-auth=true
strict-ssl=true
userconfig=/home/largra84/.npmrc

I performed a simple:

mv ~/.npmrc ~/.npmrcccc

redid my steps with cache and reinstall of npm and node.

executed the npx create-expo-app test

And the download issue was NOT present, the blocker was .npmrc somehow, i hope this might shed some light on the create-expo-app script and how it might be searching for project download source prior to installation.

Additionally i realize this probably should've been an issue rather then a PR and i apologize for any inconvenience this might've caused.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for sharing this in-detail steps and further information. I've shared this internally and will get back to you as I'm not sure what this is relates to (whether a proxy issue or something else).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Juksefantomet, it seems the issue in the .npmrc file is caused by the custom registry (fury.io). We use npm directly to check for the existence of the template name. In your case, since its a proxy, we can't exactly know. One thing you'll have to upload the template package manually as stated in gemfury docs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The custom Gemfury registry is only for private packages, I've not encountered this with any other installations. The registry is only defined so we can access our organizations private npm assets package 😄

Previously this caused issues until the strict-ssl and always-auth was defined, that usually caused multiple packages to attempt to download any package from the Gemfury registry rather then the npm registry.

But since this is related to a package acquisition during a project initialization I can't really confirm if that behavior is expected to be the same.

I do remember configuring that proxy initially was frankly quite annoying. And for that reason we are moving away from Gemfury / private registries in the near future 😄

Perhaps adding a note regarding proxy registries is in place instead or an adjustment to any non npm default registry presence could throw a warning / message to the user?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback! I've shared this internally, and we'll look into updating our tools to show a warning for this particular scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants