Cannot run gatsby develop - There was a problem loading the local develop command

Viewed 5515

I am trying to run gatsby develop in order to start the development server but I am getting the following error:

There was a problem loading the local develop command. Gatsby may not be installed in your site's "node_modules" directory. Perhaps you need to run "npm install"? You might need to delete your "package-lock.json" as well.

This is the project that I am working on: https://github.com/andreiprv/andyprv-blog

Cloned from this repo: https://github.com/alxshelepenok/gatsby-starter-lumen

It is probably a dependency issue, but I don't have the know-how to figure out how to solve it. After I started the project with gatsby new etc, I've got the following errors:

    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR!
    npm ERR! While resolving: gatsby-starter-lumen@3.0.7
    npm ERR! Found: react@17.0.1
    npm ERR! node_modules/react
    npm ERR!   react@"^17.0.1" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer react@"^16.4.2" from gatsby@2.28.0
    npm ERR! node_modules/gatsby
    npm ERR!   gatsby@"^2.27.4" from the root project
    npm ERR!   peer gatsby@"*" from @sentry/gatsby@5.28.0
    npm ERR!   node_modules/@sentry/gatsby
    npm ERR!     @sentry/gatsby@"^5.27.6" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR!
    npm ERR! See /Users/andreismbp/.npm/eresolve-report.txt for a full report.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/andreismbp/.npm/_logs/2020-12-04T17_22_00_512Z-debug.log
    error Command failed with exit code 1: npm install
    
    
      Error: Command failed with exit code 1: npm install
    
      - error.js:56 makeError
        [lib]/[gatsby-cli]/[execa]/lib/error.js:56:11
    
      - index.js:114 handlePromise
        [lib]/[gatsby-cli]/[execa]/index.js:114:26
    
      - task_queues:93 processTicksAndRejections
        node:internal/process/task_queues:93:5
    
      - init-starter.js:135 install
        [lib]/[gatsby-cli]/lib/init-starter.js:135:7
    
      - init-starter.js:202 clone
        [lib]/[gatsby-cli]/lib/init-starter.js:202:3
    
      - init-starter.js:343 initStarter
        [lib]/[gatsby-cli]/lib/init-starter.js:343:5
    
      - create-cli.js:449
        [lib]/[gatsby-cli]/lib/create-cli.js:449:9

I tried to uninstall and install gatsby again using npm uninstall --save gatsby && npm install --save gatsby

but it failed with the following errors

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: gatsby-starter-lumen@3.0.7
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.4.2" from gatsby@2.28.0
npm ERR! node_modules/gatsby
npm ERR!   peer gatsby@"*" from @sentry/gatsby@5.28.0
npm ERR!   node_modules/@sentry/gatsby
npm ERR!     @sentry/gatsby@"^5.27.6" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/andreismbp/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/andreismbp/.npm/_logs/2020-12-04T17_51_08_843Z-debug.log

Thank you in advance!

3 Answers

Did the following, ran npm install --legacy-peer-deps

Then hit another error when running gatsby develop :

Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (88)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
error undefined failed

Fixed the above by downgrading node to v14.15.1. After that I needed to run npm rebuild node-sass

I've resolved this issue by running yarn install instead of npm install

Not sure if this may be related, I had a similar issue, but mine was caused by a mismatch dependency between my node version and the version some library was using, so after changing to another version it worked for me.

I noticed that there was an error by running npm install --loglevel verbose

see if you can get additional information.

Related