Using node_modules symlink for many projects

Hello!

I need to have many projects on the same server for educational purposes. Because of that, the storage of my server will be huge, thanks to the node_modules.

I need to use only one node_modules directory. I created the symlink for all projects:

-Projects
–node_modules
–myproject1
–myproject2
–myproject3

Using Expo with tunnel and web (yarn start --tunnel --web), the web view works well. But when I try to use the Expo app to open the app in my Android, I receive the error bellow:

Error: Unable to resolve module `./node_modules/expo/AppEntry` from ``: 

None of these files exist:
  * node_modules/expo/AppEntry(.native|.android.expo.ts|.native.expo.ts|.expo.ts|.android.expo.tsx|.native.expo.tsx|.expo.tsx|.android.expo.js|.native.expo.js|.expo.js|.android.expo.jsx|.native.expo.jsx|.expo.jsx|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.wasm|.native.wasm|.wasm)
  * node_modules/expo/AppEntry/index(.native|.android.expo.ts|.native.expo.ts|.expo.ts|.android.expo.tsx|.native.expo.tsx|.expo.tsx|.android.expo.js|.native.expo.js|.expo.js|.android.expo.jsx|.native.expo.jsx|.expo.jsx|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.wasm|.native.wasm|.wasm)
    at ModuleResolver.resolveDependency (/home/ubuntu/ide/serverfiles/ide/users/1/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (/home/ubuntu/ide/serverfiles/ide/users/1/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/home/ubuntu/ide/serverfiles/ide/users/1/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
    at /home/ubuntu/ide/serverfiles/ide/users/1/node_modules/metro/src/lib/transformHelpers.js:267:42
    at Server.<anonymous> (/home/ubuntu/ide/serverfiles/ide/users/1/node_modules/metro/src/Server.js:1088:41)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/home/ubuntu/ide/serverfiles/ide/users/1/node_modules/metro/src/Server.js:99:24)
    at _next (/home/ubuntu/ide/serverfiles/ide/users/1/node_modules/metro/src/Server.js:119:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)


Stopping packager...

I tested this in MacOS and Linux and in both OS I got the same error.

Anyone can help me?

Thanks a lot.

Hi

I believe you’re running into this issue:

There are some possible workarounds in the comments.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.