healthybamboo / zenn

zennのブログ
https://zenn.dev/tkr923
0 stars 0 forks source link

monorepoでexpoアプリを作ったときに遭遇したエラー #23

Open healthybamboo opened 6 months ago

healthybamboo commented 6 months ago

はじめに

monorepoでexpoアプリを作ろうとしたときに、web で実行したときに、エラーがが出たので、その解決方法のメモ

エラー内容

Unable to resolve module ./node_modules/expo-router/entry from /Users/sakumatakeru/Documents/github/healthybamboo/physalia/services/physalia-app/.: 

None of these files exist:
  * node_modules/expo-router/entry(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.w
  * 

package.json

  "license": "MIT",
  "private": true,
  "workspaces": ["services/*"],
  "engines": {
    "node": "21.x"
  }

解決

シンボリックリンクを貼る

ln -s ../../node_modules/ node_modules

yarnのnohosiを設定する

 "workspaces": {
    "packages": [
      "services/*"
    ],
    "nohoist": [
      "**/physalia-app/**"
    ]
  },

参考

https://classic.yarnpkg.com/blog/2018/02/15/nohoist/

github-actions[bot] commented 2 weeks ago

Branch new/#23_create_monorepo_expo_app_errors has been created.

github-actions[bot] commented 2 weeks ago

Branch new/#23_create_expo_app_in_monorepo_error has been created.