Ошибка 11903 при разработке первого проекта gatsby

Я пытаюсь создать свой первый веб-сайт Gatsby. После запуска npm install -g gatsby-cli я делаю gatsby new gatsby-starter-hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world (точно так, как написано на сайте https://www.gatsbyjs.com/starters/gatsbyjs/gatsby-starter-hello-world/), чтобы загрузить приветственный мир. Когда я запускаю gatsby develop я вижу следующую ошибку

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

Я пробовал несколько вещей, в том числе npm audit fix --force, который буквально уничтожил все, и мне пришлось переустанавливать node, react и gatsby-cli. Что может быть причиной этой ошибки? Я также использую npm версии 8.5.0 и node версии 16.14.2. Прилагаю полную копию моего терминала:

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```

Пробовали ли вы переместить свой проект в другую папку? (например, рабочий стол или мои документы). Не внутри OneDrive

Ferran Buireu 21.03.2022 06:41

Я только что попробовал. Я пытался разработать его как с gatsby develop, так и с npm run develop, и последний сработал (gatsby develop выдает ошибку). Вынести его наружу OneDrive и использовать npm run develop было действительно достаточно! Спасибо за ваш вклад. Вы знаете, как OneDrive может повлиять на Гэтсби?

Pavlos Rousoglou 21.03.2022 07:06
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
В JavaScript одним из самых запутанных понятий является поведение ключевого слова "this" в стрелочной и обычной функциях.
Концепция локализации и ее применение в приложениях React ⚡️
Концепция локализации и ее применение в приложениях React ⚡️
Локализация - это процесс адаптации приложения к различным языкам и культурным требованиям. Это позволяет пользователям получить опыт, соответствующий...
Навигация по приложениям React: Исчерпывающее руководство по React Router
Навигация по приложениям React: Исчерпывающее руководство по React Router
React Router стала незаменимой библиотекой для создания одностраничных приложений с навигацией в React. В этой статье блога мы подробно рассмотрим...
Массив зависимостей в React
Массив зависимостей в React
Все о массиве Dependency и его связи с useEffect.
2
2
128
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Как было отмечено в разделе комментариев, проблема была решена путем перемещения папки проекта за пределы каталога OneDrive.

Поскольку это синхронизированная облачная папка, как только вы что-либо устанавливаете/добавляете/удаляете/обновляете, она обновляется в облаке OneDrive, поэтому файл/папка используется в фоновом режиме и потенциально недоступен. Если в это время вы попытаетесь развить проект (gatsby develop или gatsby build) и файл будет использоваться, вы не сможете его запустить.

Я не думаю, что использование облачной папки является хорошей практикой, потому что объем синхронизированных данных (в основном из-за node_modules) требует внимания (это также игнорируется в .gitignore по какой-то причине), поэтому перемещайте его в любую другую папку за пределами каталога OneDrive должно быть достаточно для запуска вашего проекта, потому что остальные глобальные зависимости, согласно вашим журналам, были успешно установлены.

Другие вопросы по теме