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

Recent Version Fails Due to Missing Modules That Exist #1922

Closed
allenweiss opened this issue Jul 3, 2023 · 11 comments
Closed

Recent Version Fails Due to Missing Modules That Exist #1922

allenweiss opened this issue Jul 3, 2023 · 11 comments

Comments

@allenweiss
Copy link

allenweiss commented Jul 3, 2023

Build/Submit details page URL

No response

Summary

I've been trying to update our app over-the-air using the same process I used a month ago. I have set up the app to receive updates and went through the standard process. Each time I get to eas update --channel production --message "in quotes"

I get this error that stops the whole process:

Error: Cannot find module 'minimatch'

This module does exist, but it is not at ./node_modules/minimatch

If I run npm ls minimatch in the node_modules folder of the project, I find three instances of this module.

I assume that Minimatch is typically installed as a dependency in the "node_modules" folder of the project. I use npm to install dependencies.

To test my "theory", I had a look at my package-lock.json file when this update worked a month ago, and minimatch did exist at ./node_modules/minimatch

I don't get asked where these modules should be stored as a user. But maybe the update can make a more thorough look for the module. If not, we are dependent, I guess, on npm to install it correctly.

Managed or bare?

Managed

Environment

expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.4.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.0/bin/yarn
npm: 9.6.7 - ~/.nvm/versions/node/v18.16.0/bin/npm
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
IDEs:
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
npmPackages:
expo: ^48.0.0 => 48.0.19
react: 18.2.0 => 18.2.0
react-native: 0.71.8 => 0.71.8
npmGlobalPackages:
eas-cli: 3.15.0
expo-cli: 6.3.8
Expo Workflow: managed

✔ Check package.json for common issues
✔ Validate global prerequisites versions
✔ Validate Expo Config
✔ Check for conflicting global packages in project
✔ Check for incompatible packages
✔ Check compatible dependency versions for the installed Expo SDK
✔ Verify prebuild support package versions are compatible

Didn't find any issues with the project!

Error output

No response

Reproducible demo or steps to reproduce from a blank project

Finish a blank project, check package-lock.json for the minimatch module folder..if it exists, first run
npm ls minimatch
to ensure the module exists somewhere else, like:
/node_modules//node_modules/minimatch

if it does, delete /node_modules/minimatch

then try to update..you'll get an error.

@allenweiss allenweiss added the needs review Issue is ready to be reviewed by a maintainer label Jul 3, 2023
@quinlanj
Copy link
Member

quinlanj commented Jul 5, 2023

@allenweiss just to sanity check before we debug any further, let's make sure your project conforms to Node.js' module resolution algorithm. Could you elaborate on how minimatch is referenced, and what the output of npm ls minimatch is?

Example with expected error

In the case where you reference minimatch directly in your project:

// App.js
import minimatch from 'minimatch';

If npm ls minimatch tells you minimatch is installed at ./node_modules/foo-module/node_modules/minimatch and nowhere else, your error is expected. In our example, we'll only ever look under ./node_modules/foo-module/node_modules when resolving dependencies declared by the foo-module.

If your project directly imports minimatch, the standard module resolution will look for it in ./node_modules/minimatch and recurse up your directory if it is not found. In our example, you will need to declare minimatch in your package.json main dependencies and run npm install (or yarn if you use that)

@quinlanj quinlanj self-assigned this Jul 5, 2023
@quinlanj quinlanj added needs more info and removed needs review Issue is ready to be reviewed by a maintainer labels Jul 5, 2023
@allenweiss
Copy link
Author

allenweiss commented Jul 5, 2023

Thank you...we do not directly import minimatch and never have. I was just using npm ls minimatch in my investigation after we started getting an error.

Here is the output

	├─┬ [email protected]
	│ └─┬ @expo/[email protected]
	│   └─┬ [email protected]
	│     └── [email protected]
	├─┬ [email protected]
	│ └─┬ @expo/[email protected]
	│   └─┬ @expo/[email protected]
	│     └─┬ @expo/[email protected]
	│       └─┬ [email protected]
	│         └─┬ [email protected]
	│           └─┬ [email protected]
	│             └── [email protected]
	└─┬ [email protected]
	  └─┬ [email protected]
	    └─┬ [email protected]
	      └─┬ [email protected]
	        └── [email protected]

@quinlanj
Copy link
Member

quinlanj commented Jul 5, 2023

Thanks for the info @allenweiss . To further debug, could you try the following:

  1. run rm -rf node_modules
  2. npm install your dependencies again. This should ensure your dependencies are consistent with your lock file.
  3. run eas update. If you get the same error, please report back with the module that is not found.
  4. Attach your package-lock.json and your package.json. feel free to remove any sensitive information from package.json, I'm only interested in the dependencies you declare.
  5. Report output of npm ls <missing-module> (assuming it is something other than the minimatch example)

@allenweiss
Copy link
Author

before running npm install, should I delete package-lock.json? Also, I was concerned about doing this before because I thought if anything changed, I shouldn't run an update (instead just do the update as a new store submission.)

@allenweiss
Copy link
Author

Ok...I didn't delete, ran install, and then eas update...got the same error (not finding minimatch). Here are the files you asked for.
Archive.zip

@allenweiss
Copy link
Author

HI @quinlanj. Any update on this? I need to figure out how to do an update else I need to submit this to the stores tomorrow because I use this app in a class I teach that starts on Thursday.

@allenweiss
Copy link
Author

HI @quinlanj...I had to submit an update to the stores. But just now I tried to do an over-the-air update and got the same error as I brought up before. Also, I updated eas-cli to the most recent version.

@expo-bot
Copy link
Contributor

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@quinlanj
Copy link
Member

hi @allenweiss , I'm very sorry for the late reply and any inconveniences to your class. I was able to reproduce your issue without manually changing the lock file. We use the metro bundler to package our code, so I'll need to confirm a couple things on our end and then look into filing an issue upstream in their project.

In order to unblock you in the meantime, you can run npm dedupe. It should deduplicate nested dependencies like in node_modules/foo/node_modules/minimatch and move them to the top level if possible. For more details, please read the repro details section

repro details

I repro'ed your issue by doing the following:

  • declaring minimatch 9 in the main package dependencies, then npm install
  • minimatch 9 should be in node_modules/minimatch and minimatch 3 used by the other dependencies will be nested in their respective directories like node_modules/foo/node_modules/minimatch
  • removing minimatch 9, npm installing again
  • minimatch should be gone from node_modules/minimatch but still present in the nested directories. This is not the most efficient way to declare dependencies, but it is still a valid lock file.

@allenweiss
Copy link
Author

allenweiss commented Jul 17, 2023

Thank you, @quinlanj....I'll try your suggestions. I just used npm dedupe and that allowed me to get past the error.

@quinlanj
Copy link
Member

Update: this issue persists in SDK 48 and 49, but it should be fixed in the upcoming SDK 50 - I've confirmed this with the repro steps mentioned above . SDK 50 is slated to be released in a couple months.

For folks that are encountering this issue in 48/49, you can unblock yourselves by running npm dedupe. If anyone encounters a similar issue in SDK 50, please file another issue.

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

No branches or pull requests

3 participants