gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.22k stars 10.33k forks source link

Can't `yarn run bootstrap` from a fresh clone of master #2395

Closed Swizec closed 6 years ago

Swizec commented 6 years ago

I tried to fix a bug/feature in Gatsby's Remark plugin and I'm having trouble getting started.

I followed instructions in CONTRIBUTING.md and they fail at step 3

setup up repo and Install dependencies: yarn run bootstrap

When I run yarn run bootstrap, I get an error saying the es2015 preset is unavailable. I solved that by running yarn add babel-preset-es2015.

Then I ran into an issue with the gatsby-react-router-scroll plugin:

lerna ERR! prepublish Errored while running script in 'gatsby-react-router-scroll'
lerna ERR! execute callback with error
lerna ERR! Error: Command failed: npm run prepublish
lerna ERR! ReferenceError: Unknown plugin "dev-expression" specified in "/Users/Swizec/Documents/random-coding/gatsby/packages/gatsby-react-router-scroll/.babelrc" at 0, attempted to resolve relative to "/Users/Swizec/Documents/random-coding/gatsby/packages/gatsby-react-router-scroll"
lerna ERR!     at /Users/Swizec/Documents/random-coding/gatsby/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17

It doesn't look like dev-expression is an npm package I can install.

What can I do to get a working build from this point?

Swizec commented 6 years ago

Ok I solved that one with yarn add babel-plugin-dev-expression.

Next error was

lerna ERR! prepublish Errored while running script in 'gatsby'
lerna ERR! execute callback with error
lerna ERR! Error: Command failed: npm run prepublish
lerna ERR! sh: copyfiles: command not found
m-allanson commented 6 years ago

@Swizec What version of Yarn are you using? I just tried this locally using Yarn 1.1.0 and it ran ok.

Swizec commented 6 years ago

@m-allanson I'm using Yarn 1.1.0

➜  gatsby git:(master) ✗ yarn --version
1.1.0
➜  gatsby git:(master) ✗ npm --version
5.4.2
➜  gatsby git:(master) ✗ node --version
v8.4.0

Perhaps the problem is that I'm on zsh not bash? But surely that has no effect here.

m-allanson commented 6 years ago

Ah wait, I'm getting the same error on a fresh checkout...

Swizec commented 6 years ago

Ok it ran through now! The last missing piece was

yarn global add copyfiles

Is it possible everybody else already has all these packages installed because they are regular contributors?

The final tally of additional commants is:

yarn add babel-preset-es2015
yarn add babel-plugin-dev-expression
yarn global add copyfiles

Now I just get missing dependencies when running yarn test. All the missing dependencies are:

redux
remark
flat
bluebird
react-docgen
unist-util-select
xml-parser
graphql
remote-redux-devtools
type-of
toml
gray-matter
documentation
json2csv
xlsx
prismjs 
eventemitter2 
retext 
yurnalist 
react sanitize-html 
sharp 
is-relative-url 
lowdb
convert-hrtime 
cheerio
image-size 
coffee-react-transform 
underscore.string
pretty-error 
retext-smartypants 
react-router-dom
stack-trace
got 
typescript
base64-img 
deep-map
imagemin 
pretty-bytes 
katex 
parse-numeric-range
remark-math 
imagemin-pngquant 
deep-map-keys 
md5-file 
coffeescript 
sift
csvtojson 
mitt 
extract-text-webpack-plugin
m-allanson commented 6 years ago

Maybe this commit had some side effects? A question for @KyleAMathews I think.

I can get yarn run bootstrap to work by checking out an older version of the project. My exact steps were:

Is that enough to get you up and running?

Swizec commented 6 years ago

After resolving all of those, I now have these failing tests on a clean clone of Gatsby.

 FAIL  packages/gatsby/src/utils/__tests__/cache.js
  ● Test suite failed to run

    TypeError: Cannot read property 'read' of null

      at LodashWrapper.db.read (node_modules/lowdb/lib/main.js:32:20)
      at Object.<anonymous>.module.exports (node_modules/lowdb/lib/main.js:51:13)
      at Object.<anonymous>.exports.initCache (packages/gatsby/src/utils/cache.js:15:8)
      at Object.<anonymous> (packages/gatsby/src/utils/__tests__/cache.js:2:7)
      at handle (node_modules/worker-farm/lib/child/index.js:44:8)
      at process.<anonymous> (node_modules/worker-farm/lib/child/index.js:51:3)
      at emitTwo (events.js:125:13)
      at process.emit (events.js:213:7)
      at emit (internal/child_process.js:774:12)
      at _combinedTickCallback (internal/process/next_tick.js:141:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)

Summary of all failing tests
 FAIL  packages/gatsby-remark-katex/src/__tests__/index.js
  ● remark katex plugin › renders inlineMath node properly

    TypeError: katex.renderToString is not a function

      at node (packages/gatsby-remark-katex/src/index.js:8:24)
      at one (node_modules/unist-util-visit/index.js:23:16)
      at all (node_modules/unist-util-visit/index.js:44:20)
      at one (node_modules/unist-util-visit/index.js:27:14)
      at all (node_modules/unist-util-visit/index.js:44:20)
      at one (node_modules/unist-util-visit/index.js:27:14)
      at visit (node_modules/unist-util-visit/index.js:14:3)
      at Object.<anonymous>.module.exports (packages/gatsby-remark-katex/src/index.js:6:3)
      at Object.it (packages/gatsby-remark-katex/src/__tests__/index.js:12:5)
          at Promise (<anonymous>)
      at Promise.resolve.then.el (node_modules/p-map/index.js:46:16)
          at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

  ● remark katex plugin › renders math node properly

    TypeError: katex.renderToString is not a function

      at node (packages/gatsby-remark-katex/src/index.js:8:24)
      at one (node_modules/unist-util-visit/index.js:23:16)
      at all (node_modules/unist-util-visit/index.js:44:20)
      at one (node_modules/unist-util-visit/index.js:27:14)
      at all (node_modules/unist-util-visit/index.js:44:20)
      at one (node_modules/unist-util-visit/index.js:27:14)
      at visit (node_modules/unist-util-visit/index.js:14:3)
      at Object.<anonymous>.module.exports (packages/gatsby-remark-katex/src/index.js:6:3)
      at Object.it (packages/gatsby-remark-katex/src/__tests__/index.js:23:5)
          at Promise (<anonymous>)
      at Promise.resolve.then.el (node_modules/p-map/index.js:46:16)
          at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

 FAIL  packages/gatsby/src/utils/__tests__/cache.js
  ● Test suite failed to run

    TypeError: Cannot read property 'read' of null

      at LodashWrapper.db.read (node_modules/lowdb/lib/main.js:32:20)
      at Object.<anonymous>.module.exports (node_modules/lowdb/lib/main.js:51:13)
      at Object.<anonymous>.exports.initCache (packages/gatsby/src/utils/cache.js:15:8)
      at Object.<anonymous> (packages/gatsby/src/utils/__tests__/cache.js:2:7)
      at handle (node_modules/worker-farm/lib/child/index.js:44:8)
      at process.<anonymous> (node_modules/worker-farm/lib/child/index.js:51:3)
      at emitTwo (events.js:125:13)
      at process.emit (events.js:213:7)
      at emit (internal/child_process.js:774:12)
      at _combinedTickCallback (internal/process/next_tick.js:141:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)

Test Suites: 2 failed, 57 passed, 59 total
Tests:       2 failed, 3 skipped, 339 passed, 344 total
Snapshots:   117 passed, 117 total
Time:        13.733s
Ran all test suites.

The badge in README says all tests should be passing so at this point I'm not sure what to do anymore.

Swizec commented 6 years ago

@m-allanson great catch! Reverting to the SHA you gave fixed everything and I can get started.

What unfortunate timing :D

Thank you.

@KyleAMathews if you know how to fix 👆 please halp. I'd love to work off of latest master.

m-allanson commented 6 years ago

@Swizec I think the PR referenced above should fix it.

KyleAMathews commented 6 years ago

Ugh, messed this up last night when reverting things. Thanks for the fix @m-allanson! Looking forward to your fix @Swizec!