NativeScript-vue build fails when using yarn workspaces

198 views Asked by At

I am having problems building a fresh NativeScript-Vue app in a monorepo project. GitHub repo here.

Situation

I would like to share some codes between a Vue.js web app and a NativeScript-Vue native app using yarn workspace. I have seen some NativeScript Slack posts that suggests using yarn workspace. From what I understand, code-sharing by nativescript-vue-cli-plugin is no longer an option here.

In the GitHub repo, I created packages/common, packages/web and packages/native and started a fresh vue proj in web and a fresh NS-Vue proj in native.

Problem

I was able to run web app inside web folder by running npm run serve but not NativeScript app in native folder by running ns run ios. Error suggests that symlink isn't working for the unpublished package:

% tns run ios
Error while loading nativescript-cloud is: Default commands should be required before child commands
Searching for devices...
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'native'
npm ERR! notarget 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mm/.npm/_logs/2020-10-16T05_08_56_467Z-debug.log
Unable to install dependencies. Make sure your package.json is valid and all dependencies are correct. Error is: Command npm failed with exit code 1

...but I have a folder named common under /node_modules, linked to /packages/common. Deleting the line "common":"1.0.0", in /packages/native/package.json allows me to build the app, but that kills the whole point of code-sharing I'm trying to achieve here.

Question

What am I doing wrong?

0

There are 0 answers