Home > Back-end >  Error 11903 when developing first gatsby project
Error 11903 when developing first gatsby project

Time:03-21

I am trying to set up my first Gatsby website. After running npm install -g gatsby-cli, I do gatsby new gatsby-starter-hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world (just like the website https://www.gatsbyjs.com/starters/gatsbyjs/gatsby-starter-hello-world/ says) to download the hello world starter. When I run gatsby develop I see the following error

ERROR #11903  COMPILATION

There was an unhandled error during compilation for C:/Users/Owner/OneDrive/Desktop/reactRep/privateRep/gatsby-starter-hello-world. 
Please run the command with the --verbose flag again.


  Error: Error opening directory

not finished compile gatsby files - 0.514s

I tried multiple things, including npm audit fix --force, which literally destroyed everything and I had to reinstall node, react and gatsby-cli. What could be causing this error? I am also using npm version 8.5.0 and node version 16.14.2. Please find attached a complete copy of my terminal:

PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep> npm install -g react

added 4 packages, and audited 5 packages in 743ms
found 0 vulnerabilities
PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep> npm install -g react-dom 

added 6 packages, and audited 7 packages in 695ms
found 0 vulnerabilities
PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep> npm install -g  react react-dom

removed 1 package, changed 9 packages, and audited 10 packages in 628ms

found 0 vulnerabilities
PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep> npm install -g bootstrap       
added 2 packages, and audited 3 packages in 2s

  run `npm fund` for details

found 0 vulnerabilities
PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep> gatsby -v
Gatsby CLI version: 4.10.1

PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep> npm install -g gatsby-cli      
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 378 packages, and audited 379 packages in 12s

61 packages are looking for funding
  run `npm fund` for details
3 moderate severity vulnerabilities

  npm audit fix --force

Run `npm audit` for details.
PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep> gatsby -v

PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep> npm gatsby new gatsby-starter-hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world
Unknown command: "gatsby"

To see a list of supported npm commands, run:
  npm help
PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep> gatsby new gatsby-starter-hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world    
info Creating new site from git: https://github.com/gatsbyjs/gatsby-starter-hello-world.git

Cloning into 'gatsby-starter-hello-world'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 15 (delta 0), reused 9 (delta 0), pack-reused 0
Receiving objects: 100% (15/15), 145.52 KiB | 2.17 MiB/s, done.
←[2K←[1A←[2K←[G←[32msuccess←[39m Created starter directory layout

←[2K←[1A←[2K←[G←[34minfo←[39m Installing packages...

npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated [email protected]: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws    For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md

added 1478 packages, and audited 1479 packages in 41s

208 packages are looking for funding
  run `npm fund` for details

19 vulnerabilities (6 moderate, 13 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Your new Gatsby site has been successfully bootstrapped. Start developing it by running:

  cd gatsby-starter-hello-world
  gatsby develop


PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep\gatsby-starter-hello-world> gatsby develop --verbose
verbose set gatsby_log_level: "verbose"
verbose set gatsby_executing_command: "develop"
verbose loading local command from: C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep\gatsby-starter-hello-world\node_modules\gatsby\dist\commands\develop.js
verbose running command: develop

verbose Transition to "initializing"

 ERROR #11903  COMPILATION

There was an unhandled error during compilation for C:/Users/Owner/OneDrive/Υπολογιστής/reactRep/privateRep-1/privateRep/gatsby-starter-hello-world. Please run the command with the --verbose flag 
again.



  Error: Error opening directory

not finished compile gatsby files - 0.509s

PS C:\Users\Owner\OneDrive\Υπολογιστής\reactRep\privateRep-1\privateRep\gatsby-starter-hello-world> npm audit
# npm audit report

ansi-html  <0.0.8
Severity: high
Uncontrolled Resource Consumption in ansi-html - https://github.com/advisories/GHSA-whgm-jr23-g3j9
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/ansi-html
  @gatsbyjs/webpack-hot-middleware  *
  Depends on vulnerable versions of ansi-html
  node_modules/@gatsbyjs/webpack-hot-middleware
    gatsby  2.3.24-ink.60 - 2.3.24-ink.61 || >=2.6.0-alpha.1
    Depends on vulnerable versions of @gatsbyjs/webpack-hot-middleware
    Depends on vulnerable versions of @pmmmwh/react-refresh-webpack-plugin
    Depends on vulnerable versions of gatsby-cli
    Depends on vulnerable versions of react-dev-utils
    node_modules/gatsby
      babel-plugin-remove-graphql-queries  >=2.17.0-next.0
      Depends on vulnerable versions of gatsby
      node_modules/babel-plugin-remove-graphql-queries
      gatsby-plugin-page-creator  >=2.11.0-next.0
      Depends on vulnerable versions of gatsby
      Depends on vulnerable versions of gatsby-plugin-utils
      node_modules/gatsby-plugin-page-creator
      gatsby-plugin-typescript  >=2.13.0-next.0
      Depends on vulnerable versions of gatsby
      node_modules/gatsby-plugin-typescript
      gatsby-plugin-utils  >=0.10.0-next.0
      Depends on vulnerable versions of gatsby
      node_modules/gatsby-plugin-utils
  @pmmmwh/react-refresh-webpack-plugin  <=0.5.0-rc.6
  Depends on vulnerable versions of ansi-html
  node_modules/@pmmmwh/react-refresh-webpack-plugin

ansi-regex  >2.1.1 <5.0.1
Severity: moderate
 Inefficient Regular Expression Complexity in chalk/ansi-regex - https://github.com/advisories/GHSA-93q8-gq69-wqmw
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/yurnalist/node_modules/ansi-regex
  strip-ansi  4.0.0 - 5.2.0
  Depends on vulnerable versions of ansi-regex
  node_modules/yurnalist/node_modules/strip-ansi
    yurnalist  >=1.0.5
    Depends on vulnerable versions of strip-ansi
    node_modules/yurnalist
      gatsby-cli  2.5.9-ink.60 - 2.5.9-ink.61 || >=2.6.0-0
      Depends on vulnerable versions of yurnalist
      node_modules/gatsby/node_modules/gatsby-cli
        gatsby  2.3.24-ink.60 - 2.3.24-ink.61 || >=2.6.0-alpha.1
        Depends on vulnerable versions of @gatsbyjs/webpack-hot-middleware
        Depends on vulnerable versions of @pmmmwh/react-refresh-webpack-plugin
        Depends on vulnerable versions of gatsby-cli
        Depends on vulnerable versions of react-dev-utils
        node_modules/gatsby
          babel-plugin-remove-graphql-queries  >=2.17.0-next.0
          Depends on vulnerable versions of gatsby
          node_modules/babel-plugin-remove-graphql-queries
          gatsby-plugin-page-creator  >=2.11.0-next.0
          Depends on vulnerable versions of gatsby
          Depends on vulnerable versions of gatsby-plugin-utils
          node_modules/gatsby-plugin-page-creator
          gatsby-plugin-typescript  >=2.13.0-next.0
          Depends on vulnerable versions of gatsby
          node_modules/gatsby-plugin-typescript
          gatsby-plugin-utils  >=0.10.0-next.0
          Depends on vulnerable versions of gatsby
          node_modules/gatsby-plugin-utils

browserslist  4.0.0 - 4.16.4
Severity: moderate
Regular Expression Denial of Service in browserslist - https://github.com/advisories/GHSA-w8qv-6jwh-64r5
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/react-dev-utils/node_modules/browserslist
  react-dev-utils  6.0.0-next.03604a46 - 12.0.0-next.60
  Depends on vulnerable versions of browserslist
  Depends on vulnerable versions of immer
  node_modules/react-dev-utils
    gatsby  2.3.24-ink.60 - 2.3.24-ink.61 || >=2.6.0-alpha.1
    Depends on vulnerable versions of @gatsbyjs/webpack-hot-middleware
    Depends on vulnerable versions of @pmmmwh/react-refresh-webpack-plugin
    Depends on vulnerable versions of gatsby-cli
    Depends on vulnerable versions of react-dev-utils
    node_modules/gatsby
      babel-plugin-remove-graphql-queries  >=2.17.0-next.0
      Depends on vulnerable versions of gatsby
      node_modules/babel-plugin-remove-graphql-queries
      gatsby-plugin-page-creator  >=2.11.0-next.0
      Depends on vulnerable versions of gatsby
      Depends on vulnerable versions of gatsby-plugin-utils
      node_modules/gatsby-plugin-page-creator
      gatsby-plugin-typescript  >=2.13.0-next.0
      Depends on vulnerable versions of gatsby
      node_modules/gatsby-plugin-typescript
      gatsby-plugin-utils  >=0.10.0-next.0
      Depends on vulnerable versions of gatsby
      node_modules/gatsby-plugin-utils

immer  <9.0.6
Severity: high
Prototype Pollution in immer - https://github.com/advisories/GHSA-c36v-fmgq-m8hx
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/immer
  react-dev-utils  6.0.0-next.03604a46 - 12.0.0-next.60
  Depends on vulnerable versions of browserslist
  Depends on vulnerable versions of immer
  node_modules/react-dev-utils
    gatsby  2.3.24-ink.60 - 2.3.24-ink.61 || >=2.6.0-alpha.1
    Depends on vulnerable versions of @gatsbyjs/webpack-hot-middleware
    Depends on vulnerable versions of @pmmmwh/react-refresh-webpack-plugin
    Depends on vulnerable versions of gatsby-cli
    Depends on vulnerable versions of react-dev-utils
    node_modules/gatsby
      babel-plugin-remove-graphql-queries  >=2.17.0-next.0
      Depends on vulnerable versions of gatsby
      node_modules/babel-plugin-remove-graphql-queries
      gatsby-plugin-page-creator  >=2.11.0-next.0
      Depends on vulnerable versions of gatsby
      Depends on vulnerable versions of gatsby-plugin-utils
      node_modules/gatsby-plugin-page-creator
      gatsby-plugin-typescript  >=2.13.0-next.0
      Depends on vulnerable versions of gatsby
      node_modules/gatsby-plugin-typescript
      gatsby-plugin-utils  >=0.10.0-next.0
      Depends on vulnerable versions of gatsby
      node_modules/gatsby-plugin-utils

node-fetch  <2.6.7
Severity: high
node-fetch is vulnerable to Exposure of Sensitive Information to an Unauthorized Actor - https://github.com/advisories/GHSA-r683-j2x4-v87g
fix available via `npm audit fix`
node_modules/cross-fetch/node_modules/node-fetch
  cross-fetch  <=3.1.4 || >=3.2.0-alpha.0
  Depends on vulnerable versions of node-fetch
  node_modules/cross-fetch
    @graphql-tools/url-loader  <=7.4.3-alpha-9f8b9c45.0
    Depends on vulnerable versions of cross-fetch
    Depends on vulnerable versions of ws
    node_modules/@graphql-tools/url-loader

ws  7.0.0 - 7.4.5
Severity: moderate
ReDoS in Sec-Websocket-Protocol header - https://github.com/advisories/GHSA-6fc8-4gx4-v693
fix available via `npm audit fix`
node_modules/ws
  Depends on vulnerable versions of cross-fetch
  Depends on vulnerable versions of ws
  node_modules/@graphql-tools/url-loader

19 vulnerabilities (6 moderate, 13 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force```

CodePudding user response:

As has been commented in the comments section, the issue has been solved by moving the project folder outside the OneDrive directory.

Because it's a synchronized cloud folder, as soon as you install/add/delete/update anything, it's being updated in the OneDrive cloud so the file/folder it's being used in the background and potentially unreachable. If at this time you try to develop the project (gatsby develop or gatsby build) and the file is being used, you won't be able to run it.

I don't think it's a good practice to use a cloud folder because the amount of data synchronized (mainly because of the node_modules) it's something to care about (it's also ignored in the .gitignore for a reason) so moving it to any other folder outside the OneDrive directory should be enough to run your project because the rest of global dependencies, according to your logs, were successfully installed.

  • Related