-
-
Notifications
You must be signed in to change notification settings - Fork 9
Capacitor: Bug after sync and open commands #6
Comments
I'm facing the exact same problem. It's also reproducible for iOS. |
Just a sidenote: We had a similiar issue in connection with that. Because we also had to preserve the modules folder to be able to build the apps on android/IOS, we had issues running our local development environment. The run command only uses the node_modules folder in the sub-project (if there is a node_modules folder which is the case now). But this means it can not use all other dependencies coming from the root project folder. The solution here was to use the workspaces feature of npm. Just add your sub-projects via workspaces like this. npm will create symlinks and as a result it should work again.
No idea if this is an ideal solution but it fixes our issue. Maybe it helps someone out there. |
Thanks, this is the type of solution I was looking for. |
We also had this issue, but after checking the source code I found out that there are special parameters, e.g.
|
@owehmer How did you solve the appearing issue regarding the run context I have described? And that brings me back again to the solution I have provided above..... |
Experiencing a similar problem and not seeing how the workspaces solution fixes the problem. With the:
in the root project.json, the links created in the file capacitor.settings.gradle, still have this :
and the node_modules folder is still deleted at the end of the sync/update/open step What makes the symbolic link (and when) and where is it supposed to point from and to? |
You can also work round this by adding the For example:
|
This issue is a massive one. Having a shared Preserving the This was working with version 15 without any issues. |
Describe the bug
When the
nx run app-name:sync:android
command is run,npm install
is executed at the beginning, so it generates anode_modules
folder in the application folder. Next, capacitor generates thecapacitor.settings.gradle
file in the Android project, which references the various capacitor packages in the application based on thenode_modules
folder in the application. Once the capacitor synchronisation command has been completed,nxext
deletes thenode_modules
folder. This means that the relative paths in thecapacitor.settings.gradle
file refer to content which does not exist.To Reproduce
At the root of your project, run :
nx run app-name:sync:android
nx run app-name:open:android
If you look to the file
capacitor.settings.gradle
, you will have this :I didn't check if there is the same problem on iOS platform.
Expected behavior
The file
capacitor.settings.gradle
must refers paths to thenode_modules
folder of the root, like this :I can't change this file because capacitor generates this file every time the sync command is used.
Additional context
I found the option
--preserveProjectNodeModules=true
which preserves thenode_modules
folder, but in my opinion it's no good having to add a parameter for the whole process to work. This option should be applied to the commandnx run app-name:sync:android
as well asnx run app-name:open:android
, because on the open command, annpm install
is also executed as well as the deletion of thenode_modules
folder.The text was updated successfully, but these errors were encountered: