Gatsby: Error running hello world. Can't resolve 'prop-types'

Created on 29 Jan 2019  路  2Comments  路  Source: gatsbyjs/gatsby

Description

@m-allanson

I am trying to run the starter hello world project and cannot seem to get thegatsby develop to run without errors.

Steps to reproduce

  1. I have updated the CLI to the latest version. (2.4.8)
  2. gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world
  3. cd hello-world
  4. gatsby develop

Expected result

gatsby should start the built-in development server

Actual result

Error: ./.cache/default-html.js
Module not found: Error: Can't resolve 'prop-types' in '/Volumes/WIP/_www/gatsby/hello-world/.cache'
resolve 'prop-types' in '/Volumes/WIP/_www/gatsby/hello-world/.cache'
Parsed request is a module
using description file: /Volumes/WIP/_www/gatsby/hello-world/package.json (relative path: ./.cache)
resolve as module
/Volumes/WIP/_www/gatsby/hello-world/.cache/node_modules doesn't exist or is not a directory
/Volumes/WIP/_www/gatsby/node_modules doesn't exist or is not a directory
/Volumes/WIP/_www/node_modules doesn't exist or is not a directory
/Volumes/WIP/node_modules doesn't exist or is not a directory
/Volumes/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /Volumes/WIP/_www/gatsby/hello-world/node_modules
using description file: /Volumes/WIP/_www/gatsby/hello-world/package.json (relative path: ./node_modules)
using description file: /Volumes/WIP/_www/gatsby/hello-world/package.json (relative path: ./node_modules/prop-types)
no extension
/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types doesn't exist
.mjs
/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.mjs doesn't exist
.js
/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.js doesn't exist
.jsx
/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.jsx doesn't exist
.wasm
/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.wasm doesn't exist
.json
/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.json doesn't exist
as directory
/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types doesn't exist
[/Volumes/WIP/_www/gatsby/hello-world/.cache/node_modules]
[/Volumes/WIP/_www/gatsby/node_modules]
[/Volumes/WIP/_www/node_modules]
[/Volumes/WIP/node_modules]
[/Volumes/node_modules]
[/node_modules]
[/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types]
[/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.mjs]
[/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.js]
[/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.jsx]
[/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.wasm]
[/Volumes/WIP/_www/gatsby/hello-world/node_modules/prop-types.json]
@ ./.cache/default-html.js 2:0-35 24:18-27 25:18-27 26:18-27 27:21-30 28:8-17 29:22-31
@ ./.cache/develop-static-entry.js

Other troubleshooting

I've also tried deleting the .cache along with node_modules and package-lock.json and re run npm install to re-install packages. Same error occurs on gatsby develop

Environment

System:
OS: OS X El Capitan 10.11.6
CPU: (8) x64 Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 6.14.3 - ~/.nvm/versions/node/v6.14.3/bin/node
npm: 3.10.10 - ~/.nvm/versions/node/v6.14.3/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 71.0.3578.98
Firefox: 64.0.2
Safari: 9.1.2
npmPackages:
gatsby: ^2.0.76 => 2.0.103
npmGlobalPackages:
gatsby-cli: 2.4.8

question or discussion

Most helpful comment

Latest node has resolved it. Thanks

All 2 comments

Hey @transf3r I'd guess this is related to using an older version of npm. It looks like you have nvm installed, so you should be able to switch to the current release of node and npm with:

nvm install node
nvm use node

Then try removing your .cache and node_modules directories and the package-lock.json file, check your npm version with npm --version and then try running npm install again.

Latest node has resolved it. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rossPatton picture rossPatton  路  3Comments

hobochild picture hobochild  路  3Comments

totsteps picture totsteps  路  3Comments

3CordGuy picture 3CordGuy  路  3Comments

jimfilippou picture jimfilippou  路  3Comments