When runing docz I get an Error: Cannot find module 'webpack/schemas/WebpackOptions.json'.
How can I solve that?
@Jole83 Execute the yarn yarn docz dev, with npm happened the error
I have the same question. So this is strictly an issue with using npm vs. yarn?
Issue #56 may also be a good reference. So far I have tried to install webpack as a dev-dependency through npm. I've gotten a new error, and saw docz try to compile which is promising:
Note: portfolio is simply the name of the repo I'm working in.
ERROR Failed to compile with 1 errors 09:36:17
error in ./.docz/app/index.jsx
Module build failed (from ./node_modules/happypack/loader.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/alex/Repos/portfolio/node_modules/babel-preset-react/lib/index.js
at createDescriptor (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:178:11)
at items.map (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
at passPerPreset (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:58:96)
at cachedFunction (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/caching.js:33:19)
at presets.presets (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:29:84)
at mergeChainOpts (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-chain.js:315:26)
at /Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-chain.js:278:7
at buildRootChain (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-chain.js:68:29)
at loadPrivatePartialConfig (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/partial.js:57:55)
at Object.loadPartialConfig (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/partial.js:82:18)
at Object.<anonymous> (/Users/alex/Repos/portfolio/node_modules/docz-core/node_modules/babel-loader/lib/index.js:105:26)
at Generator.next (<anonymous>)
at step (/Users/alex/Repos/portfolio/node_modules/docz-core/node_modules/babel-loader/lib/index.js:3:221)
@ multi ./node_modules/@babel/polyfill/lib/index.js ./.docz/app/index.jsx
So I chased this down to yet another issue. Issue #304.
If you've managed to get to the point where you are getting the Plugin/Preset error, I'm thinking your configuration has to do with Babel 7.
As @pedronauck stated in that thread,
@whoisryosuke this happen because we have some babel plugin/preset that's using an older version of babel, deleting your
node_moduelsoryarn.lockcan resolve this maybe... If this doesn't fix your bug, try to see if the version of yourbabel-preset-reactis using babel 7 馃檹
I tried deleting my package-lock.json, and npm i-ing, but still no luck.
I also tried installing @babel/preset-react following the official documentation, but I'm still receiving the same error.
Maybe you're using some package that depends on older babel, can you give a shot of you package.json @alexlee-dev ?
@pedronauck Here are my dependencies and devdependencies:
{
"dependencies": {
"dotenv": "^6.0.0",
"grommet": "^1.11.0",
"lodash.capitalize": "^4.2.1",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-scripts": "1.1.5"
},
"devDependencies": {
"ajv": "^6.5.4",
"eslint": "^5.6.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.11.1",
"eslint-plugin-standard": "^4.0.0"
}
}
weird, you don't have docz as devDependency?
Ah shoot. I forgot that I copied my package.json after I uninstalled Docz because it wasn鈥檛 working. I can install it again, but I鈥檓 99% sure it still won鈥檛 work.
This error is probably due to @babel/core v7 trying to use babel-preset-react that is in v6.
Maybe take a look at the lock file to see where it comes from?
Recently I updated react-scripts to v2.0.0 as create-react-app was recently updated. I'm not sure how much this had to do with it, but I just tried installing Docz as a dev-dependency again. Still got an error, but it's a different one. Maybe @mpivaa or @pedronauck could assist?
again, any reference to portfolio is just the project I'm working on.
> [email protected] docz:dev /Users/alex/Repos/portfolio
> docz dev
ERROR Failed to compile with 1 errors 14:32:50
error in ./.docz/app/index.jsx
Module build failed (from ./node_modules/happypack/loader.js):
Error: Cannot find module 'babel-preset-env' from '/Users/alex/Repos/portfolio'
- Did you mean "@babel/env"?
at Function.module.exports [as sync] (/Users/alex/Repos/portfolio/node_modules/resolve/lib/sync.js:40:15)
at resolveStandardizedName (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
at resolvePreset (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/files/plugins.js:58:10)
at loadPreset (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/files/plugins.js:77:20)
at createDescriptor (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
at items.map (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
at passPerPreset (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:58:96)
@ multi ./node_modules/@babel/polyfill/lib/index.js ./.docz/app/index.jsx
WAIT Compiling... 14:32:50
ERROR Failed to compile with 1 errors 14:32:50
error in ./.docz/app/index.jsx
Module build failed (from ./node_modules/happypack/loader.js):
Error: Cannot find module 'babel-preset-env' from '/Users/alex/Repos/portfolio'
- Did you mean "@babel/env"?
at Function.module.exports [as sync] (/Users/alex/Repos/portfolio/node_modules/resolve/lib/sync.js:40:15)
at resolveStandardizedName (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
at resolvePreset (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/files/plugins.js:58:10)
at loadPreset (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/files/plugins.js:77:20)
at createDescriptor (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
at items.map (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
at passPerPreset (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:58:96)
at cachedFunction (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/caching.js:33:19)
at presets.presets (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-descriptors.js:29:84)
at mergeChainOpts (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-chain.js:315:26)
at /Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-chain.js:278:7
at buildRootChain (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/config-chain.js:68:29)
at loadPrivatePartialConfig (/Users/alex/Repos/portfolio/node_modules/@babel/core/lib/config/partial.js:85:55)
@ multi ./node_modules/@babel/polyfill/lib/index.js ./.docz/app/index.jsx
You're trying to use babel-preset-env instead o @babel/env. The first one is deprecated since it's a preset from an older version of Babel. You need to update your babel packages using babel-upgrade
Fixed! Thanks @pedronauck . Installed babel-upgrade, ran it, and it re-installed Docz.
.babelrc
{
- "presets": ["env", "react"]
+ "presets": [
+ "@babel/preset-env",
+ "@babel/preset-react"
+ ]
}
Most helpful comment
Fixed! Thanks @pedronauck . Installed
babel-upgrade, ran it, and it re-installed Docz..babelrc