ignite
ignite copied to clipboard
`Error: Cannot find module 'metro-cache'` when initiating the new ignite project
Describe the bug
Thank you Infinite Red for this amazing work ๐ฏ
Here are steps I took to get started.
npx ignite-cli@latest new PizzaApp --yes
.;;,. .clll.
.clll, ,llll. ...
.,;,. ;lllc'.,. .';cllllc,
.',,. ... .'',,. .:lllllllll. .;lllc:;clll,
.llll, .,...;cllll:. ,llll, .llllllc,,' clll:'.,cllc.
,llll' ......;::. 'llcclllllllll' ,llll, .llll. ,lllllllll:'
,llll. .;clllllclll. 'llllc,..,llll, :llll. 'llll. ,lllc,''..
;llll. :llllc:cllllc. ,llll. .llll, .lllll. ,lllc... ,lll:...';:.
.llllc. ;lll;. :lll, ;lll; 'llll, .llllc. ,llllcll' .:lllllllll,
.llll, 'lll: .clll, :lll, ,llll. 'llll, 'lllllcc' ';::::;'.
.llll, ,lll: .llll' .llll, ;llll. ,llll, ..... .',..
,llll. 'llll:,,:cllll. .lllc. .''.. ... ....',; ..',,:::;'..
,llll. 'clllllllllll. ..... ..,::cllllc. .',:clllc;,'.
:llll. ',;,'.;lllc...,;:clll; ..',:cllllllllll:,;clllllc;,'.
llll: ...'cllllllllllllll::cllllllc;,',cllllllllc;'..
llll, ..,clllllllll::,,.,lllllllc:,'... :lllllc,..
c:;,. .cllllc:;:llll. ,ll:;,.. ;ll:,..
:lll,. .clll, .. .,..
:lll:,,cllll,
.cllllllllc'
.'cllll:.
โ Creating PizzaApp using Ignite 9.6.3
โ Powered by โ Infinite Red (https://infinite.red)
โ Package Manager: yarn
โ Bundle identifier: com.pizzaapp
โ Path: /Users/naoyamakino/git/PizzaApp
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐จ 3D-printing a new React Native app
๐จ Getting those last few details perfect
๐งถ Installing yarn dependencies (wow these are heavy)
Configuring app.json
๐ ๏ธ Removing fancy demo markup
๐ Backing everything up in source control
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Ignited PizzaApp in 15.71s ๐
For next time: here are the Ignite options you picked!
npx ignite-cli new PizzaApp \
--bundle=com.pizzaapp \
--git \
--install-deps \
--overwrite=false \
--packager=yarn \
--target-path=/Users/naoyamakino/git/PizzaApp \
--remove-demo=false \
--workflow=expo \
--no-timeout=false
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Need additional help?
Join our Slack community at http://community.infinite.red.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Now get cooking! ๐ฝ
cd /Users/naoyamakino/git/PizzaApp
yarn ios
Or Android via
yarn android
succeed ๐ then
cd PizzaApp; yarn ios
Starting project at /Users/naoyamakino/git/PizzaApp
Error: expo-localization tried to access @expo/config-plugins, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: @expo/config-plugins (via "@expo/config-plugins/build/android/Manifest")
Required by: expo-localization@virtual:c8e0c5b5ac0440e31d4ad667e0f0b6e78a7ec8d74de0e3d7282ee58a08367049ebf8e525d7001fa51e13a238833e05080cbd82d36e7fb653a26dddb1e1d9de7f#npm:14.8.4 (via /Users/naoyamakino/git/PizzaApp/.yarn/__virtual__/expo-localization-virtual-95d36c78a2/3/.yarn/berry/cache/expo-localization-npm-14.8.4-7f4d6b02fc-10c0.zip/node_modules/expo-localization/plugin/build/)
Require stack:
- /Users/naoyamakino/git/PizzaApp/.yarn/__virtual__/expo-localization-virtual-95d36c78a2/3/.yarn/berry/cache/expo-localization-npm-14.8.4-7f4d6b02fc-10c0.zip/node_modules/expo-localization/plugin/build/withExpoLocalization.js
- /Users/naoyamakino/git/PizzaApp/.yarn/__virtual__/expo-localization-virtual-95d36c78a2/3/.yarn/berry/cache/expo-localization-npm-14.8.4-7f4d6b02fc-10c0.zip/node_modules/expo-localization/app.plugin.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config-plugins/build/utils/plugin-resolver.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config-plugins/build/plugins/withStaticPlugin.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config-plugins/build/plugins/withPlugins.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config-plugins/build/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config/build/plugins/withConfigPlugins.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config/build/Config.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config/build/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/utils/analytics/getDevClientProperties.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/resolveOptions.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/bin/cli
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/expo/bin/cli
Error: expo-localization tried to access @expo/config-plugins, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: @expo/config-plugins (via "@expo/config-plugins/build/android/Manifest")
Required by: expo-localization@virtual:c8e0c5b5ac0440e31d4ad667e0f0b6e78a7ec8d74de0e3d7282ee58a08367049ebf8e525d7001fa51e13a238833e05080cbd82d36e7fb653a26dddb1e1d9de7f#npm:14.8.4 (via /Users/naoyamakino/git/PizzaApp/.yarn/__virtual__/expo-localization-virtual-95d36c78a2/3/.yarn/berry/cache/expo-localization-npm-14.8.4-7f4d6b02fc-10c0.zip/node_modules/expo-localization/plugin/build/)
Require stack:
- /Users/naoyamakino/git/PizzaApp/.yarn/__virtual__/expo-localization-virtual-95d36c78a2/3/.yarn/berry/cache/expo-localization-npm-14.8.4-7f4d6b02fc-10c0.zip/node_modules/expo-localization/plugin/build/withExpoLocalization.js
- /Users/naoyamakino/git/PizzaApp/.yarn/__virtual__/expo-localization-virtual-95d36c78a2/3/.yarn/berry/cache/expo-localization-npm-14.8.4-7f4d6b02fc-10c0.zip/node_modules/expo-localization/app.plugin.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config-plugins/build/utils/plugin-resolver.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config-plugins/build/plugins/withStaticPlugin.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config-plugins/build/plugins/withPlugins.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config-plugins/build/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config/build/plugins/withConfigPlugins.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config/build/Config.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/config/build/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/utils/analytics/getDevClientProperties.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/resolveOptions.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/bin/cli
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/expo/bin/cli
at Function.require$$0.Module._resolveFilename (/Users/naoyamakino/git/PizzaApp/.pnp.cjs:24517:13)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/naoyamakino/.yarn/berry/cache/@cspotcode-source-map-support-npm-0.8.1-964f2de99d-10c0.zip/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:985:27)
at Function.require$$0.Module._load (/Users/naoyamakino/git/PizzaApp/.pnp.cjs:24408:31)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (/Users/naoyamakino/git/PizzaApp/.yarn/__virtual__/expo-localization-virtual-95d36c78a2/3/.yarn/berry/cache/expo-localization-npm-14.8.4-7f4d6b02fc-10c0.zip/node_modules/expo-localization/plugin/build/withExpoLocalization.js:3:20)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at require$$0.Module._extensions..js (/Users/naoyamakino/git/PizzaApp/.pnp.cjs:24560:33)
I added the following change in the package.json
diff --git a/package.json b/package.json
index 8071ba9..0773d41 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
},
"dependencies": {
"@expo-google-fonts/space-grotesk": "^0.2.2",
+ "@expo/config-plugins": "^6.0.0",
"@expo/metro-runtime": "~3.1.3",
"@react-native-async-storage/async-storage": "1.21.0",
"@react-navigation/bottom-tabs": "^6.3.2",
@@ -48,6 +49,7 @@
with that, when I run yarn ios
yarn ios
Starting project at /Users/naoyamakino/git/PizzaApp
Error: Cannot find module 'metro-cache'
Require stack:
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/metro-config/build/ExpoMetroConfig.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/serverLogLikeMetro.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/getStaticRenderFunctions.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/metroErrorInterface.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/bundleApiRoutes.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/DevServerManager.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/startAsync.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/bin/cli
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/expo/bin/cli
Require stack:
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/metro-config/build/ExpoMetroConfig.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/serverLogLikeMetro.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/getStaticRenderFunctions.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/metroErrorInterface.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/bundleApiRoutes.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/DevServerManager.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/startAsync.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/bin/cli
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/expo/bin/cli
Error: Cannot find module 'metro-cache'
Require stack:
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/metro-config/build/ExpoMetroConfig.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/serverLogLikeMetro.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/getStaticRenderFunctions.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/metroErrorInterface.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/bundleApiRoutes.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/DevServerManager.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/startAsync.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/bin/cli
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/expo/bin/cli
Require stack:
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/metro-config/build/ExpoMetroConfig.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/serverLogLikeMetro.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/getStaticRenderFunctions.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/metroErrorInterface.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/bundleApiRoutes.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/server/DevServerManager.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/startAsync.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/src/start/index.js
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/cli/build/bin/cli
- /Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/expo/bin/cli
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Function.require$$0.Module._resolveFilename (/Users/naoyamakino/git/PizzaApp/.pnp.cjs:24556:54)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/naoyamakino/.yarn/berry/cache/@cspotcode-source-map-support-npm-0.8.1-964f2de99d-10c0.zip/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:985:27)
at Function.require$$0.Module._load (/Users/naoyamakino/git/PizzaApp/.pnp.cjs:24470:31)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (/Users/naoyamakino/.npm/_npx/249ca9fcd30c476a/node_modules/@expo/metro-config/src/ExpoMetroConfig.ts:8:1)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
then I've installed metro-cache
the following
โ yarn add metro-cache
โค YN0000: ยท Yarn 4.1.1
โค YN0000: โ Resolution step
โค YN0000: โ Completed in 0s 219ms
โค YN0000: โ Post-resolution validation
โค YN0002: โ pizza-app@workspace:. doesn't provide @types/node (p500be), requested by ts-node.
โค YN0086: โ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
โค YN0000: โ Completed
โค YN0000: โ Fetch step
โค YN0000: โ Completed in 0s 947ms
โค YN0000: โ Link step
โค YN0000: โ ESM support for PnP uses the experimental loader API and is therefore experimental
โค YN0008: โ pizza-app@workspace:. must be rebuilt because its dependency tree changed
โค YN0000: โ Completed in 1s 120ms
โค YN0000: ยท Done with warnings in 2s 448ms
but it still gives me Error: Cannot find module 'metro-cache'
error.
currently my package.json
is
diff --git a/package.json b/package.json
index 8071ba9..0773d41 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
},
"dependencies": {
"@expo-google-fonts/space-grotesk": "^0.2.2",
+ "@expo/config-plugins": "^6.0.0",
"@expo/metro-runtime": "~3.1.3",
"@react-native-async-storage/async-storage": "1.21.0",
"@react-navigation/bottom-tabs": "^6.3.2",
@@ -48,6 +49,7 @@
"expo-splash-screen": "~0.26.3",
"expo-status-bar": "~1.11.1",
"i18n-js": "3.9.2",
+ "metro-cache": "^0.80.8",
"mobx": "6.10.2",
"mobx-react-lite": "4.0.5",
"mobx-state-tree": "5.3.0",
am I missing anything? thank you โค๏ธ
Ignite version
9.6.3
Additional info
npx ignite-cli doctor
System
platform darwin
arch x64
cpu 8 cores Apple M2
directory PizzaApp /Users/naoyamakino/git/PizzaApp
/Users/naoyamakino/.npm/_npx/e31027f3785124a8/node_modules/gluegun/build/index.js:15
throw up;
^
Usage Error: The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead
$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] [--require #0] <scriptName> ...
(Use `node --trace-uncaught ...` to show where the exception was thrown)
Node.js v20.11.1
@frankcalise I was able to replicate the issue above with the following steps:
- Use
yarn 1.22.22
to Ignite a new project - @naoyamakino is using yarn 4.1.1 so let's move to that
yarn set version stable
-
yarn install && yarn ios
- ๐ the application builds without issue.
-
rm -rf node_modules
and edit the.yarnrc.yml
file to remove the linenodeLinker: node-modules
-
yarn install && yarn ios
- ๐ฅ the error that @naoyamakino is seeing above
The reason this works for switching to yarn
4.1.1 after the application is Ignited the first time is that yarn
4.1.1 will migrate the repo on first yarn install
after setting the new yarn
version:
โค YN0087: Migrated your project to the latest Yarn version ๐
This adds the missing piece to our .yarnrc.yml
file: nodeLinker: node-modules
.
I thought we were detecting the yarn
version and adding this into the .yarnrc.yml
file, but I can't find a reference to that in the repo.
@naoyamakino adding nodeLinker: node-modules
to your .yarnrc.yml
will get things working for you. Otherwise, yarn
goes into PnP mode, which I've yet to see work on any project ๐
. You may also see the following folders and directories from PnP that you can get rid of:
.pnp.cjs
.pnp.loader.mjs
.yarn/unplugged
@naoyamakino thanks for reporting the issue ๐
@morganick probably related: https://github.com/expo/expo-cli/issues/1073#issuecomment-1871186522
Thanks! I believe that worked! I am having a separate issue, which seems to be related to https://github.com/expo/expo/issues/28345, but that is at least different from what I faced in this issue. thank you for resolving this!
You're welcome @naoyamakino ๐ Happy coding!
@frankcalise shall we close this as an expo issue or did we want to do yarn
version detection?
You're welcome @naoyamakino ๐ Happy coding!
@frankcalise shall we close this as an expo issue or did we want to do
yarn
version detection?
@morganick So if we wanted to enhance the cli to work with yarn 2+, what would that look like?
Something like this we did for pnpm depending on the yarn version? https://github.com/infinitered/ignite/blob/master/src/commands/new.ts#L615-L621
@frankcalise Yes! That's the one I was thinking about! Yeah, we could do something similar for Yarn 2+.