Error: Something went wrong installing the "sharp" module / Something went wrong installing the "sharp" module - npm

I have a Gatsby project using Gatsby version 3.14.3. I need to install gatsby-plugin-image so I can have optimised images in my project. I added necessary configuration in gatsby-config:
plugins: [
`gatsby-plugin-image`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
],
and tried installing packages as well:
"gatsby-plugin-image": "1.14.1",
"gatsby-plugin-sharp": "3.14.3",
"gatsby-transformer-sharp": "3.14.0",
Note that I think these package versions are compatible with my current Gatsby version.
I get an error Error: Something went wrong installing the "sharp" module after running yarn run develop. I've tried multiple changes from other people's threads that had similar problem and couldn't make it work. I will look into updating my project to the latest Gatsby version, but it is a big project and I need to prioritise making the images work for now.
Terminal screenshot as reference:

Related

Vercel Deployment: Internal Server Error when updating NPM Packages

I'm currently working on a NUXT 2.x App and I'm hosting the dev Project on Vercel. Now since the NPM packages are outdated and I want to remove some of the packages, the Deployed Version on Vercel throws an empty page with 500 error. If i stash the changes in package.json, everything works fine on the deployed version.
How can I update / remove NPM packages from my current Version and deploy it on Vercel?
Apparently, I had to downgrade the Firebase Version from 9.5 to 9.1, then it deployed just fine on Vercel.
I do recommend the usage of yarn upgrade-interactive --latest to get a list of all the package and the possible updates.
If you want to remove a specific one, go for yarn remove my-not-so-cool-package.
Think about bumping your Node.js version to 14 and try to build locally before pushing to Vercel.
Then, it comes down to reading out the differences that you may have between the versions of the packages and fix the breaking changes if any.
Can't help more without more info from your part.

How to downgrade Gatsby version from 3.14.2 to ^2.0.0

I have a Gatsby starter (taylorbryant/gatsby-starter-tailwind) that uses gatsby-plugin-postcss which is not compatible with the version of gatsby installed in my machine like a few other plugins used in the starter. You can see the warning I get when trying to build for production.
warn Plugin gatsby-plugin-postcss is not compatible with your gatsby version 3.14.2 - It requires gatsby#^2.0.0
How can I downgrade Gatsby to a specific version, maybe just locally?
This isn't too difficult.
Open your package.json file and change the actual version you want to use.
Then run npm update to make sure you update all the packages to the right version.
Please correct me if I'm wrong but I believe that is the way to change the Gatsby version.
Please do keep in mind that this is most probably cause a bunch of other discrepancies with other packages that actually require a higher version in order to work.
You can find more information about how different versions work here: https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v2-to-v3/
Best of luck!

How to fix errors in Gridsome.js?

Problem Summary
So I'm trying to launch a new Gridsome project for local development. I've toyed with Gridsome in the past and had a great experience, so I decided to give it another shot.
This time around; however, when I run the gridsome create command, the system creates a new Gridsome site directory as expected but returns the following error message:
The instructions in this error message say to enter the newly-created site directory and run gridsome develop to start local development. However, after running cd my-gridsome-site and subsequently running gridsome develop, I then receive this error:
So far, I've tried running npm install --save from the site directory as well as yarn install, both to no avail. Thinking that this was possibly tied to my terminal, I switched from using the Zsh terminal to using the Bash terminal. This also did not work.
I'm at a loss here and could really use a hand.
Thank you for helping,
David
This seems to be an environment error. Gridsome requires Node.js (v8.3+) and recommends Yarn.
Make sure your Node.js version is v8.3+ and use only one package manager like Yarn.
to check node version: node -v
I had this same issue, but I resolved it after installing yarn and running the project with yarn instead of NPM. So you should try using yarn it will help,

GatsbyJS - Can't resolve 'babel-runtime/helpers/possibleConstructorReturn'

I have a website that has been running fine for the last 4 months. Randomly the site stopped deploying on Netlify and I keep getting this error:
Generating development JavaScript bundle failed
Can't resolve 'babel-runtime/helpers/possibleConstructorReturn' in
'D:\Websites\nemesis-cheer\node_modules\react-script-tag\lib'
I have tried reinstalling babel, tried downgrading to different versions of babel/runtime, tried clearing cache and redeploying, Even tried reverting to old versions of the repo that I know for a fact deploy successfully and they still failed.
Here is my deploy log:
https://pastebin.com/raw/dH45EtP5
The repo is:
https://github.com/mont266/nemesis-cheerleading
Im really stomped here if anyone could help me out I would really appreciate it.
Try upgrading your babel/core dependency.
Now you have it locked to 7.13.8 (according to your package-lock.json), and it seems that the missing helpers are fixed in the 7.5.5, according to this stack trace.
I fixed the issue by reinstalling yarn and doing 'yarn add babel-runtime'. Must've gotten rid of the entire plugin at somepoint by accident.
I suggest you to try adding "babel-runtime": "6.26.0" to your package.json
Maybe it would fix an error for you

can't resolve app.module.ngfactory when using yarn webpack:prod

In my application, the front-end and back-end are separated, get this issue when I issue:
yarn webpack:prod
to generate a front-end package for production. however:
yarn start
works fine.
Note:
angular version is 5.1.0
jhipter version is 4.14.3
yarn version is 1.3.2
Very appreciated for any suggestion and help.
upgrade seems too complex, so I regenerate a new jhipster project, the angular 5.1 is upgraded to 5.2. then copy my source code to the new project.
Because #angular/http is updated to #angular/common/http, I did a lot of code change manually, and finally get it worked.