question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'

See original GitHub issue

Is this a bug report?

YES (write your answer here)

Did you try recovering your dependencies?

5.8.0 (Write your answer here.)

Which terms did you search for in User Guide?

Error: Cannot find module (Write your answer here if relevant.)

Environment

  1. node -v: v8.9.4
  2. npm -v: 5.8.0
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected):

Then, specify:

  1. Operating system: 7.4.0 Darwin Kernel Version 17.4.0 AND Ubuntu 16.04
  2. Browser and version (if relevant):

Steps to Reproduce

upgrade react-scripts from 1.0.11 to 1.1.1 and node from v7.4.0 to v8.9.4.

simply upgrading react-scripts from 1.0.11 to 1.1.1 works with v7.4.0, build fails with v8.9.4 (Write your steps here:)

  1. update package.json to react-scripts 1.1.1
  2. bash$ n 8.9.4
  3. bash$ rm -rf node_modes && npm i
  4. bash$ npm run build

Expected Behavior

Expected to build to work as when running with npm run build with node v7.4.0. (Write what you thought would happen.)

Actual Behavior

> REACT_APP_ENV=production react-scripts build

module.js:540
    throw err;
    ^


Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/Barry/projects/e/node_modules/html-webpack-plugin/lib/compiler.js:11:26)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/Barry/projects/e/node_modules/html-webpack-plugin/index.js:7:21)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! e@0.1.0 build: `REACT_APP_ENV=production react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the e@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

(Write what happened. Please add screenshots!)

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bgitscommented, Apr 6, 2018

Upgrading to 1.1.2 fixed this issue. Thank you.

0reactions
pv-912commented, Jul 24, 2018

Yes, this issue occurs with 1.1.4 but fix with 1.1.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'webpack/lib/node/NodeTemplatePlugin ...
This error occurs only when webpack doesn't exist locally, so if your package.json has webpack mentioned in its devDependencies —this should do ...
Read more >
Error: Cannot find module 'webpack/lib/node ... - GitHub
Hi, I get the same error after running webpack command:: module.js:341 - I have node v5.6.0 - working on the React.js program, as...
Read more >
Error Cannot find module webpack lib node ... - Edureka
Got this Error after running webpack. Webpack is installed globally and I'm running Node PS D:\Projects .
Read more >
How to fix Error: cannot find module "webpack" - Educative.io
The Cannot find module webpack occurs when webpack is not globally installed. It is a problem with the npm script or application. You...
Read more >
[SOLVED] Error Cannot find module 'webpack/lib ... - YouTube
Hello guys today's video, i'm going to show you how to fix the " Error : Cannot find module ' webpack / lib...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found