TypeError: Cannot read property 'tokenizePlaceholders' of undefined
BobWalsh opened this issue · comments
With gatsby version 1.1.51 did:
gatsby new YourProjectName https://github.com/haysclark/gatsby-starter-casper
npm install # or yarn install
npm run develop # or gatsby develop
and immediately hit:
TypeError: Cannot read property 'tokenizePlaceholders' of undefined
- prism-php.js:121
[gatsby-test2]/[prismjs]/components/prism-php.js:121:40
- prism.js:456 Object.run
[gatsby-test2]/[prismjs]/prism.js:456:5
- prism.js:287 Object.highlight
[gatsby-test2]/[prismjs]/prism.js:287:11 [. . . and 18 other errors.]
Suggestions, pointers or workarounds?
I was also facing this issue. Removing the php
code block in /content/sample-posts/2017-01-01/index.md
file resolved this error.
Failed idea: I tried yarn upgrade prismjs@1.13.0
(i.e. downgrade from 1.14.0). That made no difference.
Deleting the 2017-01-01 folder that sasivarnan described, does seem to get past it, but then stops on GraphQLError: Cannot query field "author" on type "frontmatter".
(it is then doing "createPages" for a long time.) But these might be unrelated problems?
@BobWalsh Great catch and I'm very sorry about this issue. This issue was my fault for not including the yarn.lock with the project. As time has gone on a sub-dependency of gatsby-remark-prismjs (prismjs) has slowly been upgraded. Users that used npm install
missed this issue, but that meant that the README.md file was not incorrect. I have updated the repo so that Yarn users will get the needed prismjs@1.9.0 dependancy. Because the issue is caused by a sub-dependancy, you'll likely have better luck if you replace your current yarn.lock file with the new version. Running yarn upgrade prismjs@1.9.0
will not fix the issue. Additionally, you will need to delete your public and .cache folders. You can do this by running npm run clean
.
Hope that helps!