packages installed with Yarn start to give error like sweetalert2 - ruby-on-rails

I am working on rails 6.
couple of hours back I added sweetalert2 with yarn like
yarn add sweetalert2
and than imported it like
import Swal from 'sweetalert2'
it was working fine and than I switched github branch & when came back to original branch,
it started to give error like
Cannot find module 'sweetalert2'
not sure if missed something or what happened.
UPDATE
I did yarn install but it says already up to date & same issue still exist.
yarn install v1.21.1
warning ../package.json: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.76s.

For sure, when you switch the branch, you can retry with npm install and yarn command as the code base has been changed/switched.
Try running yarn and npm install again.

Related

yarn_install failed: yarn install v1.22.11

when I try to run mediapipe iOS demo by yarn, but I only get a "yarn_install failed: yarn install v1.22.11" response,Oddly enough, my Mac has yarn version 1.22.19, Have you ever been in a situation like this?
change the version config or I can user yarn v1.22.19 to make a successful.
The solution was to replace the yarn with the required version 1.22.11. The source could be downloaded from here
More about the yarn version control here

vips/vips8 file not found #include <vips/vips8> in Ionic cordova in IOS

I found an error in sharp.
After that, I found a blog in which they ask to delete sharp from the node module and run sudo npm i.
I have gone through GitHub and write minipass - 2.7.0
After that, I got a new error in
vips/vips8 file not found #include <vips/vips8>
I'm using Ionic with Angular on Macbook
I use commands which is
1.sudo npm install
2.sudo npm i gulp-sass -ES --unsafe-perm=true
3.sudo ionic cordova platform add ios
I very recently ran into a similar issue after making some changes to a project's package.json on my Mac (not an Angular or Cordova project).
I came across this GitHub issue for the sharp package which mentioned you may need to update the globally-installed version of libvips: https://github.com/lovell/sharp/issues/1148
In my case, since I use Homebrew but had not directly installed this package previously, I was able to resolve by running brew install vips and then re-running npm install. Note that it has a lot of dependencies so installation may take some time.
Edit: if that doesn't work, you may need to try a fresh install by removing node_modules, then re-running npm i.
This might be not applicable to everyone, but remove package-lock.json and node_modules directory first and then try npm install again. (I also added the minipass in my package.json, by the way)
In my case, I had encountered the same error, but I could solve it by doing the above.

yarn install skips packages on Jenkins

When run manually, yarn install works without a hitch.
When run from Jenkins, however, one package is simply missing! Even when run after a manual execution. I only run a single instance of yarn each time.
In both cases (manual and Jenkins) I use the same working directory and the same user. The missing package is ng, and it's a dependency of #angular (yarn install creates more package.json files in nested folders).
Any ideas what could be the cause of this issue?
Currently I use yarn install --check-files as a workaround until I figure out why yarn deletes packages in the first place. If anyone has a better solution I'd like to hear it :)

React-native#0.26.3 requires a peer of react#15.0.2 but none was installed

I am trying to set up for the react native. but whenever I update files it gives m error
enoent ENOENT: no such file or directory, open 'React Native/package.json'
npm WARN react-native#0.26.3 requires a peer of react#15.0.2 but none was installed.
npm WARN React Native No description
npm WARN React Native No repository field.
npm WARN React Native No README data
npm WARN React Native No license field.
MacBook-Pro:React Native$ npm info react dist-tags.latest
Please let me know how can I fix.
Installing react should fix the error
npm install react --save
Also, you may try upgrading your react-native install. react-native is as v0.30.0 now
npm update react-native
In my specific case I was running npm install in the wrong directory. I thought I was in my project directory but was one level higher. This meant react was missing from installed packages (because there were none) and thus gave this error.
Some steps that worked for me:
1. watchman watch-del-all
2. rm -rf node_modules
3. npm install react#15.0.2 --save
4. npm install react#15.1.0 --save
5. npm install
6. rm -fr $TMPDIR/react-*
7. npm start -- --reset-cache
In my case, the project I am working on requires a specific version of React. Since it was older than the current release, doing an install/update would still cause the error.
In order to fix the problem, I had to check the package.json of the project and install the exact version allowed by the dependency definition. In the OP's case, a
npm install react#15.0.2
should fix the problem by installing the exact version of the React module that react-native requires.
Verify that the condition was resolved by doing a npm list to see if there are any other unmet peer dependencies.

Using "npm install" to install jquery-ui

I see from here https://github.com/jquery/jquery-ui that jquery-ui's latest release is 1.11.4. However, when I use "npm install jquery-ui", it's only 1.10.3. I checked this version in node_modules/jquery-ui/jquery-ui.js.
Is there any way for me to install the latest version?
jQuery-ui specifically needs to be build after installation. To avoid this, use npm install jquery-ui-dist
T J gave the right answer, but it is a bit short / too generic.
The GitHub project is at https://github.com/jquery/jquery-ui/
So the real command would be npm install github:jquery/jquery-ui (you can even skip github: as npm defaults to it).
But this would bring you the latest, unstable version (around 1.12 at time of writing), and it didn't even work when I tried.
So it is better to fetch a tagged version:
npm install github:jquery/jquery-ui#1.11.4
Generic note: AFAIK, if the project hasn't a package.json file, this kind of install can still fail.
Here is the current latest version (1.11.4), same package that bower is using, including all themes.
npm install github:components/jqueryui#1.11.4
You can install it like
npm install github:mygithubuser/myproject
as mentioned in the install documentation

Resources