Tips for resolving Error: ENOENT - file or directory not found:

As a newcomer to Gatsby, I am currently following this tutorial hosted at .

After executing the 'gatsby develop' command, everything appears to be successful. However, I encounter the following error:

Error: ENOENT: no such file or directory, open 'C:\users[my_username]\Documents\chrono\my_first_gatsby.cache\json_using-typescript_.json'

Here are the steps I have followed:

  1. Opened Git bash
  2. Ran npm install --global gatsby-cli
  3. Ran gatsby --version (confirmed that I have the latest version of Gatsby)
  4. Ran cd [directory name]
  5. Ran gatsby new my_first_gatsby (created a new Gatsby default starter project)
  6. Ran cd my_first_gatsby
  7. Ran gatsby develop (expected result was a link to Gatsby's live local development server, but encountered the aforementioned error)

My local environment details are as follows:

 System: 
    OS: Windows 10 10.0.18363 
    CPU: (12) x64 Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz 
  Binaries: <br/>
    Node: 15.3.0 - C:\Program Files\nodejs\node.EXE 
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD 
    npm: 7.0.14 - C:\Program Files\nodejs\npm.CMD 
  Languages: 
    Python: 2.7.15 - /c/Users/ahmed/.windows-build-tools/python27/python 
  Browsers: 
    Chrome: 86.0.4240.198 
    Edge: Spartan (44.18362.449.0) 
  npmPackages: 
    ...
  npmGlobalPackages:
    gatsby-cli: 2.14.1

Answer №1

To get started, make sure to install all dependencies, clear your cache, and start developing your project with these commands:

  • npm install
  • gatsby clean
  • gatsby develop

If you encounter any persistent errors, delete the node_modules folder, cache folder, and package-lock.json, then run the installation process again.

For Windows users working with Gatsby on Windows, it's important to install additional dependencies for a smoother experience:

npm install --global windows-build-tools --vs2015

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with BrowserRouter, improperly looping through the array using map

Encountering an issue with importing content in my React app project using <BrowserRouter>. Within the app, there are 3 Material-UI Tabs: /lights, /animations, /settings. <Switch> <Route path="/lights" component={LightsMenu} /> ...

"Step-by-step guide on setting up Angularjs ng-model in a Rails environment

Question regarding the utilization of two-way binding in AngularJS and Rails ERB files. Let's say the input value in my .erb file has an initial value like this: example.erb <input type="text" value=" <%= @item.title %> " ng-model ="item.t ...

Implementing a secure route in React that asynchronously checks user authentication status

Currently, I have a React app utilizing Auth from the aws-amplify package (version 5.3.8) and react-router-dom (version 5.3.0). Although there is a version specifically for React available, it necessitates using at least version 5.0.0 of react-scripts, whe ...

Is the .npmignore file overlooked by yarn?

For the sake of learning, I decided to create an npm package and share it on a Github repository. My goal was to install the package from a specific branch on the Github repository. In my folder, I have: a/ b/ c/ .gitignore .npmignore package.json To ign ...

Discovering the current date in Angular 8 by utilizing the form builder

Is there a way to automatically fill a form created with FormBuilder with the system's date and time when it is created, instead of the default date format? this.creationDate = moment().format(DATE_TIME_FORMAT); I want to update the creationDate fie ...

Select the hidden HTML option value automatically according to the previous option selected

I am working on a form that includes 2 select tags with the options male and female. The first select, "gender", is visible to the user while the second select, "age", is hidden. <select name="gender"> <option value="1">Male</option> ...

Using Class as a Parameter

I recently started using TypeScript and encountered an implementation issue. I'm working on a class that takes another class as an argument. The challenge is that it can be any class, but I want to define certain possible class properties or methods. ...

Complete a submission using an anchor (<a>) tag containing a specified value in ASP.Net MVC by utilizing Html.BeginForm

I am currently using Html.BeginFrom to generate a form tag and submit a request for external login providers. The HttpPost action in Account Controller // // POST: /Account/ExternalLogin [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public Acti ...

Display a DIV element when hovering over another DIV element using CSS or JavaScript without them being directly related as parent and

So I've figured out how to use CSS to show a hidden div when you hover over its parent. But what if the hidden div is not a child of the parent you want to hover on? How do you make it appear then? For example: <div class="field-1"></div> ...

Finding out whether the current date falls between a startDate and endDate within a nested object in mongoose can be done by using a specific method

My data structure includes a nested object as shown: votingPeriod: {startDate: ISOdate(), endDate: ISOdate()}. Despite using the query below, I am getting an empty object back from my MongoDB. const organizations = await this.organizationRepository.find( ...

Sending a JavaScript string to a PHP script from a Chrome extension content script

I am currently developing a chrome extension that is designed to extract text data from specific websites when I visit them, and then store this data in a SQL database. The JavaScript code for data extraction is functioning correctly and is able to capture ...

Guide on how to showcase an array in a string format using table rows in JavaScript or jQuery

After making an AJAX call to a PHP database, I receive a String as a result in my script. The format of the string is shown below: array(4) { [0]=> array(3) { ["id"]=> string(3) "181" ["number"]=> ...

Is there a way to maintain scroll position on a dynamically refreshing div?

After searching for hours, I still can't find a solution to my problem. I am using a simple JQuery script to refresh a div and display my PHP output in it. $script = " <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery ...

Property 'map' is not recognized on type 'Object' and needs to be addressed

I am currently using Angular CLI: 6.0.8 and have implemented the service shown below. However, my code editor's linter keeps showing an error message that reads: [ts] Property 'map' does not exist on type 'Object'. any The error ...

SignOut operation in Express.js Firebase instantly responds with a status of 200 to the client-side Fetch POST request

I'm currently facing an issue with my POST request setup using the Fetch API in my client-side JavaScript. The request is being sent to my server-side JavaScript code which utilizes Express Js and Firebase Auth. The problem arises when the auth().sign ...

identify when the React component has reached the bottom of the element by reading the

Is there a way to access the scroll handler's event without being able to access offsetTop, scrollTop, etc? class App extends React.Component { handleScroll = e => { console.log(e.target.scrollTop); }; componentDidMo ...

What is the method for utilizing a function's input type specified as "typeof A" to output the type "A"?

Check out this example from my sandbox: class A { doSomething() {} } class B {} const collection = { a: new A(), b: new B() } const findInstance = <T>(list: any, nonInstance: T): T => { for (const item in list) { if (lis ...

After installing Ember and running the Ember server, I noticed that the node_modules directory appears to be empty. This issue is occurring on my Windows 10 x64 PC

Welcome to the command console: C:\Users\Documents\emberjs>ember server node_modules seem to be empty, consider running `npm install` Ember-cli version: 2.14.2 Node version: 6.11.2 Operating System: Windows 32-bit x64 I'm a beg ...

Detecting duplicate key values within a JSON array using Angular.js

I am seeking a solution in Angular.js to verify if duplicate key values exist within a JSON array. Below is a breakdown of my code: var result=[{ "email":'<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ec8dac8b ...

Using jQuery to alter hover color using a dynamic color picker

I'm looking to update the hover color using a color picker tool. Here are the methods I've attempted: // Initial Attempt $("input[type=color]").change(function(e) { var selectedColor = e.target.value; // $("body").css("background-color ...