Работает на windows 10, с правами администратора. npm -v: 6.13.4 узел -v: v12.14.1
Проработав несколько месяцев над проектом, я решил запустить npm update
, чтобы получить новейшие библиотеки. С тех пор я пропускаю файлы в своей папке node_modules
...
Я попытался полностью удалить папку node_modules
и снова запустить npm install
.
У меня есть даже попытался восстановить старый файл package-lock.json
из предыдущего коммита. И в другой попытке - я удалил файл package-lock.json
и позволил ему пересоздать себя.
При попытке запустить код (это проект Gatsby, поэтому я запускаю gatsby develop
), я получаю ошибка, что файл с именем async.js
отсутствует в библиотеке с именем neo-async
. Полное сообщение об ошибке:
ERROR
gatsby develop
Start development server. Watches files, rebuilds, and hot reloads if something changes
Options:
--verbose Turn on verbose output [boolean] [default: false]
--no-color, --no-colors Turn off the color in output [boolean] [default: false]
--json Turn on the JSON logger [boolean] [default: false]
-H, --host Set host. Defaults to localhost [string] [default: "localhost"]
-p, --port Set port. Defaults to 8000 [string] [default: "8000"]
-o, --open Open the site in your (default) browser for you. [boolean]
-S, --https Use HTTPS. See https://www.gatsbyjs.org/docs/local-https/ as a guide [boolean]
-c, --cert-file Custom HTTPS cert file (relative path; also required: --https, --key-file). See https://www.gatsbyjs.org/docs/local-https/ [string] [default: ""]
-k, --key-file Custom HTTPS key file (relative path; also required: --https, --cert-file). See https://www.gatsbyjs.org/docs/local-https/ [string] [default: ""]
--open-tracing-config-file Tracer configuration file (OpenTracing compatible). See https://gatsby.dev/tracing [string]
-h, --help Show help [boolean]
-v, --version Show the version of the Gatsby CLI and the Gatsby package in the current project [boolean]
ERROR
There was a problem loading the local develop command. Gatsby may not be installed. Perhaps you need to run "npm install"? Cannot find module 'C:\gatsbyproj\node_modules\neo-async\async.js'. Please verify that the package.json has a valid "main" entry
Cannot find module 'C:\gatsbyproj\node_modules\neo-async\async.js'. Please verify that the package.json has a valid "main" entry
- loader.js:297 tryPackage
internal/modules/cjs/loader.js:297:19
- loader.js:528 Function.Module._findPath
internal/modules/cjs/loader.js:528:18
- loader.js:780 Function.Module._resolveFilename
internal/modules/cjs/loader.js:780:27
- loader.js:686 Function.Module._load
internal/modules/cjs/loader.js:686:27
- loader.js:848 Module.require
internal/modules/cjs/loader.js:848:19
- helpers.js:74 require
internal/modules/cjs/helpers.js:74:18
- Compiler.js:8 Object.<anonymous>
[gatsbyproj]/[webpack]/lib/Compiler.js:8:18
- loader.js:955 Module._compile
internal/modules/cjs/loader.js:955:30
- loader.js:991 Object.Module._extensions..js
internal/modules/cjs/loader.js:991:10
- loader.js:811 Module.load
internal/modules/cjs/loader.js:811:32
Файл async.js
фактически отсутствовал, поэтому я переименовал C:\gatsbyproj\node_modules\neo-async\async.min.js
в async.js
, чтобы посмотреть, что произойдет, перезапустить код и получить ошибка об отсутствии файла в другой библиотеке. Полное сообщение о следующей ошибке:
ERROR
gatsby develop
Start development server. Watches files, rebuilds, and hot reloads if something changes
Options:
--verbose Turn on verbose output [boolean] [default: false]
--no-color, --no-colors Turn off the color in output [boolean] [default: false]
--json Turn on the JSON logger [boolean] [default: false]
-H, --host Set host. Defaults to localhost [string] [default: "localhost"]
-p, --port Set port. Defaults to 8000 [string] [default: "8000"]
-o, --open Open the site in your (default) browser for you. [boolean]
-S, --https Use HTTPS. See https://www.gatsbyjs.org/docs/local-https/ as a guide [boolean]
-c, --cert-file Custom HTTPS cert file (relative path; also required: --https, --key-file). See https://www.gatsbyjs.org/docs/local-https/ [string] [default: ""]
-k, --key-file Custom HTTPS key file (relative path; also required: --https, --cert-file). See https://www.gatsbyjs.org/docs/local-https/ [string] [default: ""]
--open-tracing-config-file Tracer configuration file (OpenTracing compatible). See https://gatsby.dev/tracing [string]
-h, --help Show help [boolean]
-v, --version Show the version of the Gatsby CLI and the Gatsby package in the current project [boolean]
ERROR
There was a problem loading the local develop command. Gatsby may not be installed. Perhaps you need to run "npm install"? Cannot find module './lodash'
Require stack:
- C:\gatsbyproj\node_modules\lodash\index.js
- C:\gatsbyproj\node_modules\gatsby\dist\db\loki\nodes.js
- C:\gatsbyproj\node_modules\gatsby\dist\redux\reducers\index.js
- C:\gatsbyproj\node_modules\gatsby\dist\redux\index.js
- C:\gatsbyproj\node_modules\gatsby\dist\utils\gatsby-dependents.js
- C:\gatsbyproj\node_modules\gatsby\dist\utils\webpack.config.js
- C:\gatsbyproj\node_modules\gatsby\dist\commands\develop.js
- C:\Users\AdminUser\AppData\Roaming\npm\node_modules\gatsby-cli\lib\create-cli.js
- C:\Users\AdminUser\AppData\Roaming\npm\node_modules\gatsby-cli\lib\index.js
Error: Cannot find module './lodash'
Require stack:
- C:\gatsbyproj\node_modules\lodash\index.js
- C:\gatsbyproj\node_modules\gatsby\dist\db\loki\nodes.js
- C:\gatsbyproj\node_modules\gatsby\dist\redux\reducers\index.js
- C:\gatsbyproj\node_modules\gatsby\dist\redux\index.js
- C:\gatsbyproj\node_modules\gatsby\dist\utils\gatsby-dependents.js
- C:\gatsbyproj\node_modules\gatsby\dist\utils\webpack.config.js
- C:\gatsbyproj\node_modules\gatsby\dist\commands\develop.js
- C:\Users\AdminUser\AppData\Roaming\npm\node_modules\gatsby-cli\lib\create-cli.js
- C:\Users\AdminUser\AppData\Roaming\npm\node_modules\gatsby-cli\lib\index.js
- loader.js:793 Function.Module._resolveFilename
internal/modules/cjs/loader.js:793:17
- loader.js:686 Function.Module._load
internal/modules/cjs/loader.js:686:27
- loader.js:848 Module.require
internal/modules/cjs/loader.js:848:19
- helpers.js:74 require
internal/modules/cjs/helpers.js:74:18
- index.js:1 Object.<anonymous>
[gatsbyproj]/[lodash]/index.js:1:18
- loader.js:955 Module._compile
internal/modules/cjs/loader.js:955:30
- loader.js:991 Object.Module._extensions..js
internal/modules/cjs/loader.js:991:10
- loader.js:811 Module.load
internal/modules/cjs/loader.js:811:32
- loader.js:723 Function.Module._load
internal/modules/cjs/loader.js:723:14
- loader.js:848 Module.require
internal/modules/cjs/loader.js:848:19
Содержимое моего package.json
файла:
{
"name": "gatsby-starter-hello-world",
"private": true,
"description": "A simplified bare-bones starter for Gatsby",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing \""
},
"dependencies": {
"@emotion/core": "^10.0.21",
"gatsby": "^2.16.1",
"gatsby-plugin-emotion": "^4.1.12",
"gatsby-source-filesystem": "^2.1.33",
"gatsby-transformer-yaml": "^2.2.15",
"logrocket": "^1.0.3",
"prop-types": "^15.7.2",
"react": "^16.10.2",
"react-bootstrap": "^1.0.0-beta.14",
"react-datepicker": "^2.9.6",
"react-dom": "^16.10.2",
"react-dropdown-select": "^3.6.5",
"react-ga": "^2.7.0",
"react-helmet": "^5.2.1",
"react-redux": "^7.1.1",
"react-textfit": "^1.1.0",
"redux": "^4.0.4",
"superagent": "^5.1.0"
},
"devDependencies": {
"eslint": "^6.5.1",
"eslint-plugin-react": "^7.16.0",
"prettier": "^1.18.2"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
Есть идеи?