简体   繁体   中英

How to solve Error: ENOENT: no such file or directory

I am brand new at Gatsby and I am currently following this tutorial. https://www.michaeluloth.com/starting-a-new-gatsby-project .

When I type in the command 'gatsby develop' everything shows up to be successful. Yet in the end, it gives the error:

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

Steps I followed:

  1. Open Git bash
  2. Run npm install --global gatsby-cli
  3. Run gatsby --version (this verified that I have the latest gatsby version)
  4. Run cd [directory name]
  5. Run gatsby new my_first_gatsby (created a brand new gatsby default starter-project)
  6. Run cd my_first_gatsby
  7. Run gatsby develop (expecting a link to gatsby's live local development server but it produces the above error.

my local environment is 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: 
    gatsby: ^2.24.47 => 2.24.77 
    gatsby-cli: ^2.12.66 => 2.12.107 
    gatsby-image: ^2.0.39 => 2.4.21 
    gatsby-plugin-anchor-links: ^1.2.0 => 1.2.0 
    gatsby-plugin-feed-mdx: ^1.0.0 => 1.0.1 
    gatsby-plugin-local-search: ^1.1.1 => 1.1.1 
    gatsby-plugin-manifest: ^2.0.29 => 2.4.34 
    gatsby-plugin-mdx: ^1.2.14 => 1.2.46 
    gatsby-plugin-netlify-cms: ^4.3.7 => 4.3.16 
    gatsby-plugin-offline: ^3.2.23 => 3.2.31 
    gatsby-plugin-react-helmet: ^3.0.12 => 3.3.14 
    gatsby-plugin-root-import: ^2.0.5 => 2.0.5 
    gatsby-plugin-sharp: ^2.0.35 => 2.6.42 
    gatsby-plugin-smoothscroll: ^1.2.0 => 1.2.0 
    gatsby-plugin-styled-components: ^3.0.7 => 3.3.14
    gatsby-plugin-typography: ^2.6.0 => 2.6.0
    gatsby-remark-copy-linked-files: ^2.0.11 => 2.3.19
    gatsby-remark-images: ^3.3.9 => 3.3.33
    gatsby-remark-responsive-iframe: ^2.1.1 => 2.4.17
    gatsby-remark-smartypants: ^2.0.9 => 2.3.13
    gatsby-remark-vscode: ^2.1.2 => 2.1.2
    gatsby-source-filesystem: ^2.0.29 => 2.3.34
    gatsby-transformer-sharp: ^2.1.18 => 2.5.17
  npmGlobalPackages:
    gatsby-cli: 2.14.1

Run install your dependencies, clean your cache, and develop your project by:

  • npm install
  • gatsby clean
  • gatsby develop

If the error persists, remove your node_modules , your cache folder, and your package-lock.json and repeat the process.

In addition, since working with Gatsby on Windows it's a bit tricky, I would recommend installing some other dependencies:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM