Gatsby: NetlifyCMS Plugin Missing /dist folder in v2.0.1

Created on 17 Apr 2018  路  6Comments  路  Source: gatsbyjs/gatsby

Description

We're trying to upgrade to the latest version of the Netlify CMS plugin, but are getting a build error.

error There was an error compiling the html.js component for the development server.

See our docs page on debugging HTML builds for help https://goo.gl/yL9lND


  Error: Module not found: Error: Cannot resolve module 'netlify-cms/dist/cms.css' in <my_project_path>/node_modules/gatsby-plugin-netlify-cms
  resolve module netlify-cms/dist/cms.css in <my_project_path>/node_modules/gatsby-plugin-netlify-cms
    looking for modules in <my_project_path>/node_modules
      <my_project_path>/node_modules/netlify-cms doesn't exist (module as directory)
    looking for modules in <my_project_path>/node_modules
      <my_project_path>/node_modules/netlify-cms doesn't exist (module as directory)
...etc... (repeats quite a few times)

Steps to reproduce

I presume you could take the NetlifyCMS starter and upgrade it to the latest version and see the same.

Expected result

I should be able to use NetlifyCMS with Gatsby.

Actual result

Because the /dist folder wasn't published to NPM, the build fails.

Environment

(I suspect this doesn't matter but will supply more info if needed.)

File contents (if changed):

(I suspect this doesn't matter but will supply more info if needed.)

Most helpful comment

I was having the same issue and a fixed by running npm install --save netlify-cms gatsby-plugin-netlify-cms@next as now documented https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-netlify-cms

I did end up running into a couple other issues that Im not sure if they are related. Incase it helps here they are:

Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'
Fix (not sure if correct): npm install @babel/[email protected]

Next Error: TypeError: Cannot destructure property 'createHash' of 'undefined' or 'null'.
Fix (not sure if correct): Removed node_modues rm -rf node_modules. Then ran yarn to reinstall. npm install did not work.

I hope this helps as I'm no expert.

All 6 comments

I suspect this is just that I didn't correctly install the peer dep. Will re-open if necessary.

I have the same bug. We need to add 'netlify-cms' package for fix it.

Looks like you now need to list netlify-cms as a dependancy yourself: https://github.com/gatsbyjs/gatsby/pull/4974

This is still an issue when updating your modules.

"dependencies": {
    "bulma": "^0.7.1",
    "gatsby": "^1.9.277",
    "gatsby-link": "^1.6.46",
    "gatsby-plugin-netlify": "^1.0.21",
    "gatsby-plugin-netlify-cms": "^2.0.1",
    "gatsby-plugin-react-helmet": "^2.0.11",
    "gatsby-plugin-sass": "^1.0.26",
    "gatsby-plugin-sharp": "^1.6.48",
    "gatsby-remark-images": "^1.5.67",
    "gatsby-source-filesystem": "^1.5.39",
    "gatsby-transformer-remark": "^1.7.44",
    "gatsby-transformer-sharp": "^1.6.27",
    "lodash": "^4.17.10",
    "lodash-webpack-plugin": "^0.11.5",
    "netlify-cms": "^2.0.9",
    "prop-types": "^15.6.2",
    "react": "^16.4.2",
    "react-helmet": "^5.2.0",
    "uuid": "^3.3.2"
  },

Error: Module not found: Error: Cannot resolve module 'netlify-cms/dist/cms.css'

Having the same issue as OP. netlify-cms is listed as a dependency, but develop throws the same errors as in the original post.

I was having the same issue and a fixed by running npm install --save netlify-cms gatsby-plugin-netlify-cms@next as now documented https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-netlify-cms

I did end up running into a couple other issues that Im not sure if they are related. Incase it helps here they are:

Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'
Fix (not sure if correct): npm install @babel/[email protected]

Next Error: TypeError: Cannot destructure property 'createHash' of 'undefined' or 'null'.
Fix (not sure if correct): Removed node_modues rm -rf node_modules. Then ran yarn to reinstall. npm install did not work.

I hope this helps as I'm no expert.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dustinhorton picture dustinhorton  路  3Comments

magicly picture magicly  路  3Comments

andykais picture andykais  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

kalinchernev picture kalinchernev  路  3Comments