Error upgrading dependencies in yarn.lock file with yarn up in Yarn 2.0 - yarn-workspaces

I'm trying to use Yarn 2.0 to upgrade to the latest version of the dependency in my yarn.lock to resolve a dependabot issue. The issue exists with the ini dependency and I tried running command yarn up ini which resulted in the following error:
❯ yarn up ini
Usage Error: Pattern ini doesn't match any packages referenced by any workspace
I noticed that I can use yarn up to upgrade packages in package.json file, but haven't been able to figure out how to update a dependency in a yarn.lock. I'm wondering if anyone knows what command I should be using instead?
Any help would be greatly appreciated. Thank you!
Documentation Source: https://yarnpkg.com/getting-started/migration#renamed

I learned that you can't upgrade individual dependencies in the yarn-lock file, you have to upgrade package with the dependency in the package.json file by running the command:
yarn up ${package_name} followed by yarn install in Yarn 2.0.

I noticed that I can use yarn up to upgrade packages in package.json file, but haven't been able to figure out how to update a dependency in a yarn.lock. I'm wondering if anyone knows what command I should be using instead?
Starting from 3.0, transitive dependencies (ie dependencies of dependencies) can be upgraded using yarn up -R <name>.

Related

Yarn Unknown Syntax Error: Unsupported option name ("--check-files")

When I try to run yarn install --check-files on a rails repo that I cloned I'm getting the following error:
Unknown Syntax Error: Unsupported option name ("--check-files").
$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
I've tried updating yarn and node to the latest stable versions
I've tried deleting yarn/node modules and yarn.lock in the local folder and running yarn install again
I've tried yarn upgrade --latest which also brings up a similar error Usage Error: Couldn't find a script named "upgrade".
I'm currently using volta to manage my versions and have not had too much trouble up until now.
I've previously run --check-files on other repos with no problems.
Ok turns out my system was running yarn 3.* globally which was conflicting with my rails version (6.0.5). I had originally installed yarn using brew so I had to uninstall and start again with npm using the following steps:
brew uninstall yarn to remove yarn with brew
npm install -g yarn to install yarn with npm
yarn set version classic to set yarn version to 1.*
yarn -v to make sure I was on version 1.*

Rails: Webpack-dev-server has unmet peer dependency

I am currently trying to set up a Rails 6.0.2 application on Ubuntu 18.0.4 using Docker.
I have successfully set up the database using PostgreSQL and I have installed the necessary gems by running the command below:
bundle install
However, when I try to install the node packages using the command below:
yarn install
I get the message below which gives me some concern that something is not right:
warning " > webpack-dev-server#3.10.3" has unmet peer dependency "webpack#^4.0.0 || ^5.0.0".
warning "webpack-dev-server > webpack-dev-middleware#3.7.2" has unmet peer dependency "webpack#^4.0.0".
I have tried a few solutions but it's not working. I need some help. Thank you.
Here's how I solved:
Simply run the command below to upgrade the version of yarn to your desired version:
yarn upgrade webpack#^4.0.0
Note: You can substitute 4.0.0 with the required version for yarn, say 5.0.0.
Another Solution
Add the version of webpack that you want to your package.json file. Here the version of webpack used is 4.43.0:
"devDependencies": {
"webpack": "^4.43.0",
"webpack-dev-server": "^3.11.0"
}
And then run yarn install to install webpack
For Docker Applications only:
Add the command just before the yarn install command in your Dockerfile:
RUN yarn upgrade webpack#^4.0.0 \
yarn install
Reference to this on GitHub: Unmet peer dependencies
That's all.
I hope this helps.
I upgraded packages one at a time but kept getting the same warnings.
So I ran:
yarn upgrade
and next time I ran this all the warnings messages there were there previously had gone away:
yarn install

How to install angular-json-editor with yarn which is available with bower package?

I want to install angular-json-editor. This is available with bower but I want to install it using Yarn packages.
Any help please.
Just:
yarn --modules-folder lib/ add angular-json-editor
to add angular-json-editor to folder lib/

Grunticon & TravisCI

We are running into an issue when Grunticon is being installed into our Rails 4 engine on TravisCI. I'd appreciate any ideas on:
Making the path shorter for installing Grunticon in Rails
A way for TravisCI to skip installing Grunticon during our builds (we don't need it for testing)
A way to upgrade npm on TravisCI (rumor has it that npm v3 may solve this)
Error from Travis:
Gem::Package::TooLongFileName: File "node_modules/grunt-grunticon/node_modules/grunticon-lib/node_modules/directory-colorfy/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile" has a too long path (should be 256 or less)
An error occurred while installing trusty-convoy-extension (0.0.3), and Bundler
cannot continue.
Make sure that `gem install trusty-convoy-extension -v '0.0.3'` succeeds before
bundling.
The command "eval bundle install --jobs=3 --retry=3 --deployment --path=${BUNDLE_PATH:-vendor/bundle}" failed. Retrying, 2 of 3.
Grunticon is installed using a Gruntfile.js in our root directory. That triggers scripts in a node_modules directory. We followed this guide: https://github.com/filamentgroup/grunticon
Thanks!
Update: Successfully installed npm 3 on TravisCI.
before_install:
- npm install -g npm#3.x-latest
Sadly, did not fix the issue.
In your Travis preinstall..
npm i -g npm#3
Npm 3 is in late beta, and will give you a much more flat directory structure.
Note: you will need to add any peer dependencies to your package.json

Error installing Protractor in ROR4 + AngularJS app various attempts

Using Ubuntu debian flavour, have been unsuccessfully trying to install protractor following:
the AngularJS official docs tutorial
by installing nodejs, npm and then downloading protractor from github repo as suggested here.
finally by installing the protractor-rails gem as per this SO.
I can see my nodejs version being: v0.10.25 and npm version being 1.3.10
however when I run either npm install protractor, or npm install -g protractor or follow the steps as per Protractor::Rails
in all cases I get the same error:
Ideas anyone?
Basically, this is a problem of permissions for creating directory.
You should try to set the permission on npm directory in your home dir.
sudo chown -R `whoami` ~/.npm
It is indeed a permissions issue coupled with some linux legacy code.
For those who may run into the same issue, a few steps to follow to sort this out:
the Debian installation has a legacy dir called node, this dir has to be removed and the package nodejs-legacy be installed instead.
Once nodejs-legacy has been installed, you may run the protractor installation (in your project folder) as follows:
sudo npm install -g protractor
once installation is finished check your
protractor --version
you should then get a Version 2.0.0 (as of today in my case)
You should be ready to update your webdriver and fire it up.

Resources