Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Peter Mingione
Peter Mingione
10,489 Points

I am unable to start or build the application in the course React Router 4 Basics

Hi All, I am unable to start or build the application in the course React Router 4 Basics. I have been able to successfully complete this course in the past but now I am getting errors. I am not sure what has changed.


Here is the error that I am getting in the browser ...


Html Webpack Plugin: Error: Child compilation failed: Module.createRequire is not a function

  • child-compiler.js:169 childCompiler.runAsChild [course-directory]/[html-webpack-plugin]/lib/child-compiler.js:169:18

  • Compiler.js:564 compile [course-directory]/[webpack]/lib/Compiler.js:564:11

  • Compiler.js:1183 hooks.afterCompile.callAsync.err [course-directory]/[webpack]/lib/Compiler.js:1183:17

  • Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync] [course-directory]/[tapable]/lib/Hook.js:18:14

  • Compiler.js:1179 compilation.seal.err [course-directory]/[webpack]/lib/Compiler.js:1179:33

  • Compilation.js:2785 finalCallback [course-directory]/[webpack]/lib/Compilation.js:2785:11

  • Compilation.js:3090 hooks.afterSeal.callAsync.err [course-directory]/[webpack]/lib/Compilation.js:3090:11

  • Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync] [course-directory]/[tapable]/lib/Hook.js:18:14


And here is the error I am getting in the terminal ...


Failed to compile.

Module not found: Error: Can't resolve 'react/lib/React' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' asset static/js/bundle.js 1.13 MiB [emitted] (name: main) 1 related asset asset index.html 1.03 KiB [emitted] asset asset-manifest.json 190 bytes [emitted] runtime modules 28.2 KiB 13 modules modules by path ./node_modules/ 973 KiB 249 modules modules by path ./src/ 16.9 KiB modules by path ./src/css/*.css 13.8 KiB ./src/css/index.css 2.77 KiB [built] [code generated] ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/css/index.css 11 KiB [built] [code generated] ./src/index.js 1.58 KiB [built] [code generated] ./src/components/App.js 1.55 KiB [built] [code generated]

ERROR in ./node_modules/react-dom/lib/LinkedValueUtils.js 16:12-38 Module not found: Error: Can't resolve 'react/lib/React' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactDOMTextarea.js 13:23-52 @ ./node_modules/react-dom/lib/ReactDOMComponent.js 43:23-52 @ ./node_modules/react-dom/lib/ReactDefaultInjection.js 24:24-54 @ ./node_modules/react-dom/lib/ReactDOM.js 14:28-62 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactChildReconciler.js 39:31-74 Module not found: Error: Can't resolve 'react/lib/ReactComponentTreeHook' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactMultiChild.js 22:27-60 @ ./node_modules/react-dom/lib/ReactDOMComponent.js 47:22-50 @ ./node_modules/react-dom/lib/ReactDefaultInjection.js 24:24-54 @ ./node_modules/react-dom/lib/ReactDOM.js 14:28-62 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactCompositeComponent.js 13:12-38 Module not found: Error: Can't resolve 'react/lib/React' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/instantiateReactComponent.js 13:30-66 @ ./node_modules/react-dom/lib/ReactMount.js 44:32-70 @ ./node_modules/react-dom/lib/ReactDOM.js 16:17-40 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactCompositeComponent.js 17:24-62 Module not found: Error: Can't resolve 'react/lib/ReactCurrentOwner' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/instantiateReactComponent.js 13:30-66 @ ./node_modules/react-dom/lib/ReactMount.js 44:32-70 @ ./node_modules/react-dom/lib/ReactDOM.js 16:17-40 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactDOMInvalidARIAHook.js 12:29-72 Module not found: Error: Can't resolve 'react/lib/ReactComponentTreeHook' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactDOM.js 109:32-68 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactDOMNullInputValuePropHook.js 10:29-72 Module not found: Error: Can't resolve 'react/lib/ReactComponentTreeHook' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactDOM.js 107:39-82 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactDOMOption.js 12:12-38 Module not found: Error: Can't resolve 'react/lib/React' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactDOMComponent.js 39:21-48 @ ./node_modules/react-dom/lib/ReactDefaultInjection.js 24:24-54 @ ./node_modules/react-dom/lib/ReactDOM.js 14:28-62 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactDOMUnknownPropertyHook.js 14:29-72 Module not found: Error: Can't resolve 'react/lib/ReactComponentTreeHook' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactDOM.js 105:36-76 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactDebugTool.js 15:29-72 Module not found: Error: Can't resolve 'react/lib/ReactComponentTreeHook' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactInstrumentation.js 14:23-50 @ ./node_modules/react-dom/lib/ReactDOM.js 103:29-62 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactMount.js 16:12-38 Module not found: Error: Can't resolve 'react/lib/React' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactDOM.js 16:17-40 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactMount.js 20:24-62 Module not found: Error: Can't resolve 'react/lib/ReactCurrentOwner' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactDOM.js 16:17-40 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactMultiChild.js 18:24-62 Module not found: Error: Can't resolve 'react/lib/ReactCurrentOwner' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactDOMComponent.js 47:22-50 @ ./node_modules/react-dom/lib/ReactDefaultInjection.js 24:24-54 @ ./node_modules/react-dom/lib/ReactDOM.js 14:28-62 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactNodeTypes.js 13:12-38 Module not found: Error: Can't resolve 'react/lib/React' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/getHostComponentFromComposite.js 10:21-48 @ ./node_modules/react-dom/lib/ReactDOM.js 26:36-78 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/ReactUpdateQueue.js 12:24-62 Module not found: Error: Can't resolve 'react/lib/ReactCurrentOwner' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactMount.js 38:23-52 @ ./node_modules/react-dom/lib/ReactDOM.js 16:17-40 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/checkReactTypeSpec.js 71:37-80 Module not found: Error: Can't resolve 'react/lib/ReactComponentTreeHook' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactCompositeComponent.js 30:27-58 @ ./node_modules/react-dom/lib/instantiateReactComponent.js 13:30-66 @ ./node_modules/react-dom/lib/ReactMount.js 44:32-70 @ ./node_modules/react-dom/lib/ReactDOM.js 16:17-40 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/findDOMNode.js 12:24-62 Module not found: Error: Can't resolve 'react/lib/ReactCurrentOwner' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactDOM.js 24:18-42 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/flattenChildren.js 43:33-76 Module not found: Error: Can't resolve 'react/lib/ReactComponentTreeHook' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactMultiChild.js 26:22-50 @ ./node_modules/react-dom/lib/ReactDOMComponent.js 47:22-50 @ ./node_modules/react-dom/lib/ReactDefaultInjection.js 24:24-54 @ ./node_modules/react-dom/lib/ReactDOM.js 14:28-62 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/instantiateReactComponent.js 19:21-56 Module not found: Error: Can't resolve 'react/lib/getNextDebugID' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/ReactMount.js 44:32-70 @ ./node_modules/react-dom/lib/ReactDOM.js 16:17-40 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in ./node_modules/react-dom/lib/traverseAllChildren.js 12:24-62 Module not found: Error: Can't resolve 'react/lib/ReactCurrentOwner' in '/Users/petermingione-macbook-home/Desktop/react-router-4/1-Getting-Started-with-React-Router/3-Introducing-the-Project/course-directory/node_modules/react-dom/lib' @ ./node_modules/react-dom/lib/flattenChildren.js 13:26-58 @ ./node_modules/react-dom/lib/ReactMultiChild.js 26:22-50 @ ./node_modules/react-dom/lib/ReactDOMComponent.js 47:22-50 @ ./node_modules/react-dom/lib/ReactDefaultInjection.js 24:24-54 @ ./node_modules/react-dom/lib/ReactDOM.js 14:28-62 @ ./node_modules/react-dom/index.js 3:0-42 @ ./src/index.js 5:0-33 9:0-15

ERROR in Module.createRequire is not a function

ERROR in Error: Child compilation failed: Module.createRequire is not a function

  • child-compiler.js:169 childCompiler.runAsChild [course-directory]/[html-webpack-plugin]/lib/child-compiler.js:169:18

  • Compiler.js:564 compile [course-directory]/[webpack]/lib/Compiler.js:564:11

  • Compiler.js:1183 hooks.afterCompile.callAsync.err [course-directory]/[webpack]/lib/Compiler.js:1183:17

  • Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync] [course-directory]/[tapable]/lib/Hook.js:18:14

  • Compiler.js:1179 compilation.seal.err [course-directory]/[webpack]/lib/Compiler.js:1179:33

  • Compilation.js:2785 finalCallback [course-directory]/[webpack]/lib/Compilation.js:2785:11

  • Compilation.js:3090 hooks.afterSeal.callAsync.err [course-directory]/[webpack]/lib/Compilation.js:3090:11

  • Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync] [course-directory]/[tapable]/lib/Hook.js:18:14

1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)

19 errors have detailed information that is not shown. Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.69.1 compiled with 22 errors in 5588 ms