• 24-Jan-2023
Lightrun Team
Author Lightrun Team
Share
This article is about fixing Unable to install dependencies in Cobiwave Gatsby Simplefolio

Unable to install dependencies in Cobiwave Gatsby Simplefolio

Lightrun Team
Lightrun Team
24-Jan-2023

Explanation of the problem

I am encountering errors while attempting to install dependencies for a project. The errors are similar to those of a previously reported issue, but with slight variations. The attached log file (log.txt) contains the complete error output. The specific error message displayed is:

npm ERR! code 1
npm ERR! path C:\Users\anton\Documents\Projects\personal-website-3\personal-website-3\gatsby-simplefolio\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\anton\Documents\Projects\personal-website-3\personal-website-3\gatsby-simplefolio\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Users\\anton\\Documents\\Projects\\personal-website-3\\personal-website-3\\gatsby-simplefolio\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.13.1 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\anton\Documents\Projects\personal-website-3\personal-website-3\gatsby-simplefolio\node_modules\node-gyp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\Users\anton\Documents\Projects\personal-website-3\personal-website-3\gatsby-simplefolio\node_modules\node-gyp\node

Troubleshooting with the Lightrun Developer Observability Platform

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

Problem solution for Unable to install dependencies in Cobiwave Gatsby Simplefolio

The error encountered in the question is caused by a mismatch between the current version of Node and the version required by the node-sass dependency. Node-sass is a library that allows Node.js to compile .scss files to .css files. It requires a specific version of Node to work properly. When the version of Node is not compatible with the version of node-sass, it can cause issues when trying to build or run the project.

One solution to this issue is to use a version manager to install an older version of Node. The version of Node that is compatible with the current version of node-sass can be found on the GitHub releases page of the project. A version manager allows you to easily switch between different versions of Node, which can be helpful in resolving compatibility issues. One of the most popular version managers is nvm, which stands for Node Version Manager.

To use nvm to install an older version of Node, you can use the following command:

nvm install <version>

where <version> is the version of Node that is compatible with node-sass (e.g. 13.14.0). Once the correct version of Node is installed, you can use the following command to switch to it:

nvm use <version>

After that, you can run your project again, and it should work properly. Windows users may need to install the nvm for Windows version and run the terminal as an administrator to switch Node versions.

Another solution is to downgrade Node version to 14.x which is currently supported by node-sass. This can be done by following the instructions provided by Node.js and downloading the version that is compatible with node-sass then you can install it on your system.

node -v

This command will show the version of Node.js that is currently installed on your system.

node <version number>

This command will change the version of Node.js to the one you want, and you can use the node-sass library without any problem.

It’s worth noting that if the issues persist, it might be worth considering pulling the latest version of the repo on the develop branch and transferring the content manually. This will ensure that you have the latest version of the dependencies and that you are not running into any compatibility issues.

Other popular problems with Gatsby Simplefolio

Problem: “Error: No matching version found for gatsby-image” when trying to build or run the project

This error occurs when the version of the gatsby-image package installed in the project is not compatible with the version of Gatsby that is being used.

Solution:

The solution to this problem is to update the version of the gatsby-image package in the project to match the version of Gatsby. To do this, you will need to open the package.json file in the project root directory and update the version of gatsby-image to the latest version. You can use the following command to update the package:

npm install gatsby-image@latest

Or

yarn add gatsby-image@latest

Once the package has been updated, you should be able to build and run the project without encountering the error message.

Problem: “Error: Node Sass does not yet support your current environment”  when trying to build or run the project

This error occurs when the version of Node Sass is not compatible with the version of Node.js that is being used.

Solution:

The solution to this problem is to update the version of Node Sass to match the version of Node.js. To do this, you will need to open the package.json file in the project root directory and update the version of node-sass to the latest version. You can use the following command to update the package:

npm install node-sass@latest

Or

yarn add node-sass@latest

Once the package has been updated, you should be able to build and run the project without encountering the error message.

Problem: “Error: Can’t resolve ‘./src/templates/blog-post’ in ‘project path'” when trying to build or run the project

This error occurs when the project is missing the required files and folders to properly build the project.

Solution:

The solution to this problem is to create the missing files and folders in the project. To do this, you will need to create a folder named “src” in the project root directory, and within that folder create another folder named “templates”, and within that folder, you will need to create a file named “blog-post.js”. You can use the following command to create the folder and file:

mkdir -p src/templates
touch src/templates/blog-post.js

Once you have created the missing files and folders, the project should be able to build and run without encountering the error message.

A brief introduction to Gatsby Simplefolio

Gatsby Simplefolio is a starter template for creating a portfolio website using the Gatsby.js framework. Gatsby.js is a static site generator built on React.js that allows developers to create fast and performant websites using modern web technologies. Gatsby Simplefolio comes pre-configured with a set of features and tools that are commonly used in portfolio websites such as a blog, portfolio section, and contact page.

The template is built using GraphQL, which is a query language for APIs. Gatsby’s integration with GraphQL allows developers to easily retrieve and manipulate data from various sources such as markdown files, headless CMS, and more. Additionally, Gatsby Simplefolio uses the gatsby-image package, which is an image optimization plugin that automatically generates various sizes of images and serves them using the best size for the user’s device. Gatsby Simplefolio is built with a responsive design, which means it can adapt to different screen sizes and devices. Additionally, the template uses SCSS for styling which allows for easy and efficient styling.

Most popular use cases for Gatsby Simplefolio

  1. Gatsby Simplefolio can be used to create a portfolio website for showcasing a developer’s work. The template comes pre-configured with a portfolio section that allows developers to easily add and display their projects. The portfolio section is built using React components, which allows for easy customization and flexibility in terms of design and layout.
<PortfolioSection
    title="My Projects"
    projects={[
        {
            title: "Project Title",
            link: "https://project.com",
            image: {
                src: "https://project.com/image.jpg",
                alt: "Project screenshot"
            },
            description: "A brief description of the project"
        },
        // ... more projects
    ]}
/>
  1. Gatsby Simplefolio can be used to create a blog for sharing knowledge and updates about the developer’s work. The template comes pre-configured with a blog section that allows developers to easily add and display their blog posts. The blog section is built using Markdown and GraphQL, which allows for easy adding, editing, and retrieving of blog posts.
  2. Gatsby Simplefolio can be used as a base for creating other types of websites. The template comes pre-configured with common web development tools such as React, GraphQL, and SCSS, which can be used to create other types of websites such as e-commerce, landing pages, and
Share

It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications. It’s a registration form away.

Get Lightrun

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.