NativeScript-vue build fails when using yarn workspaces - vue.js

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 common#1.0.0.
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?

Related

NPM equivalent of maven's install:install-file goal

I've come across an issue where one of my transitive dependencies went missing from the NPM registry, either due to a user error, or some other action. Being used to converting plain java projects to maven, I would depend on install plugin and install-file(1) goal to create a pom.xml file for that jar (a package.json equivalent), and it would be put into local repository under .m2 folder. Afterwards other projects could refer to it as if the package was available remotely.
In NPM I'm seeing that an equivalent to "referring to local package" works via link sub command, but what it really does is writes absolute path on local system to the needed package. That is great in scenario when you control a dependent package, but not so much when you don't.
I've also attempted to do the naive way of "installing a package globally" (such as using github tarball), because on github the release, and source code are still present. But since the tool that's also fetched from the NPM registry specifies that it must pull dependencies from the registry ignores the globally installed version of that library and fails. The command line of this would be as follows:
npm install -g https://github.com/{user}/{repo}/tarballs/{tag}
added 915 packages from 60 contributors
npm install -g "foo-cli#{tag}"
npm ERR! code ETARGET
npm ERR! notarget No matching version found for {repo}#^{tag}.
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 'foo-cli'
npm ERR! notarget
This does raise several questions:
Does local registry exist?
How do I tell NPM to first check "locally installed" versions for tools I do not control?
Am I stuck forking the tool to "link" it against my locally installed version of missing library?

I cannot npm install with just created vue2 + vuetify proj

installed latest vue/cli and created project using vue2.
After this, I added vuetify and thats all for additional to basic vue2 template list of packages.
When I have tryed to use 'npm install'
Found: #vue/cli-service#undefined
npm ERR! node_modules/#vue/cli-service
npm ERR! dev #vue/cli-service#"5.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #vue/cli-service#"^3.0.0 || ^4.0.0 || ^5.0.0-0" from #vue/cli-plugin-babel#5.0.0
npm ERR! node_modules/#vue/cli-plugin-babel
npm ERR! dev #vue/cli-plugin-babel#"5.0.0" from the root project`
can you guys explain me meaning of error
myVersions
As you are seemingly on an old version of npm (<=6.x) you need to install the peer dependency yourself:
npm i -D #vue/cli-service#5.0.0
After installing the dependency, edit your package.json and insert this block on the top level, right after the "devDependencies" object:
"peerDependencies": {
"#vue/cli-service": "^5.0.0"
}
and remove that dependency from the "devDependencies" object.
If you don't want to deal with peer dependencies yourself, upgrade your node and npm version. To upgrade npm only:
npm i -g npm
Despite the fact that I reconfigured entire project. I will anyway answer this question.
Issue was related to cli-service 5.0.0, when I should have had 5.0.8 in order to use babel 5.0.0.
I want to add that if you use default vue.2 template with vue/cli 5.0.8,
You will get another error after installing vuetify, which was not able to fix.
Error is related to vuetify loader.
I fixed it with start up new project and manually inserting all dependencies compatible with vuetify-loader 1.5
Because 1.7 brakes npm run serve

NPM 8 workspaces - Install one package as the dependency for another package in monorepo

Say I have the following structure
packages
- #my-scope/packageA
- #my-scope/packageB
- #my-scope/packageC
Let's say I want to install packageA as a dependency of packageB. With NPM 8 workspaces I would think this ought to do it:
npm install #my-scope/packageA --workspace=#my-scope/packageB
Instead I get this:
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#my-scope%2fpackageA - Not found
npm ERR! 404
npm ERR! 404 '#my-scope/packageA#*' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Clearly it is trying to get it from the registry (and no, I haven't published yet, not ready) but I want it to recognize that this dependency is in my project as a workspace. Anyone know why this might be happening? I haven't found many good resources explaining how to install dependencies from inside your monorepo (I don't even know what those are called...).
The problem you are facing has been reported as a bug: https://github.com/npm/cli/issues/3637
It has been marked as fixed.
Please try to install the latest version of npm (8.8.0 as of this writing) and see if your problem has been resolved.

unable to downgrade from angular 6 to angular 5

I created my project using angular 6 but due to some reasons i want to rollback to angular 5,I tried following commands but it is showing some errors.
node version- 10.4.1
npm version-6.1.0
npm ERR! code ETARGET
npm ERR! notarget No matching version found for #angular/cli#1.7.
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! A complete log of this run can be found in:
npm ERR! C:\Users\TEKIZMA USER\AppData\Roaming\npm-cache\_logs\2018-06-
27T0
_21_53_446Z-debug.log
Please try to follow this Stack Answer
According to my knowledge first, try to downgrade NPM then angular.
And you might need to read this too.
Try possibly this way
npm install -g #angular/cli#YOUR_DESIRED_VERSION
You do not need to reinstall global version of Angular CLI.
Instead, you can use NPX library like:
npx -p #angular/cli#<version> new <app-name>

Error when using 'create-react-native-app'

I tried to create a new React Native app using the command create-react-native-app in the node.js terminal on my Windows system. I got the following terminal error:
D:\project>create-react-native-app crna
Creating a new React Native app in D:\project\crna.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...
npm WARN deprecated fs-promise#1.0.0: Use mz or fs-extra^3.0 with Promise Suppor
t
npm WARN deprecated #exponent/spawn-async#1.2.8: Please switch to #expo/spawn-as
ync, the new name of this package. It's the same code with our new name.
npm ERR! shasum check failed for C:\Users\ui-admin\AppData\Local\Temp\npm-3204-a
eacedd1\registry.npmjs.org\_40exponent\ngrok\-\ngrok-2.2.7.tgz
npm ERR! Expected: 37fe66f922b1003da2a78c66b7d4d3bc9313e423
npm ERR! Actual: d134060eb730b880da06d5c040ca933f6a75b613
npm ERR! From: https://registry.npmjs.org/#exponent/ngrok/-/ngrok-2.2.7.tgz
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ui-admin\AppData\Roaming\npm-cache\_logs\2017-05-26T09_36_
04_379Z-debug.log
`npm install --save-dev --save-exact react-native-scripts` failed
Anyone met this error or fix it?
I got the same error, though in RubyMine, which provided the response that react-native doesn't work with npm 5 yet. it said you can either revert to npm 4 or feel free to log an issue here: https://github.com/npm/npm/issues/16991
I think you're best bet would be to revert and wait it out!