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.

Updating to webpack 2 and webpack-dev-server: Cannot find module

See original GitHub issue

Hi,

I tried out the example, but updating to webpack 2 (we’re trying to update on a project). But we’re getting a series of errors:

app.js:12781 Uncaught Error: Cannot find module "react-i18next"
    at webpackMissingModule (app.js:12781)
    at Object.<anonymous> (app.js:12781)
    at __webpack_require__ (app.js:20)
    at Object.<anonymous> (app.js:31928)
    at __webpack_require__ (app.js:20)
    at validateFormat (app.js:66)
    at app.js:69
app.js:12847 [WDS] Errors while compiling. Reload prevented.
app.js:12925 ./app/main.js
Module not found: Error: Can't resolve 'react-i18next' in '/Users/me/react-i18next/example/app'
 @ ./app/main.js 11:20-44
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./app/main.js
errors @ app.js:12925
app.js:12925 ./app/components/View.js
Module not found: Error: Can't resolve 'react-i18next' in '/Users/me/react-i18next/example/app/components'
 @ ./app/components/View.js 15:20-44
 @ ./app/components/App.js
 @ ./app/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./app/main.js
errors @ app.js:12925
app.js:12925 ./app/components/AnotherComponent.js
Module not found: Error: Can't resolve 'react-i18next' in '/Users/me/react-i18next/example/app/components'
 @ ./app/components/AnotherComponent.js 11:20-44
 @ ./app/components/View.js
 @ ./app/components/App.js
 @ ./app/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./app/main.js
errors @ app.js:12925
app.js:12925 ./app/components/YetAnotherComponent.js
Module not found: Error: Can't resolve 'react-i18next' in '/Users/me/react-i18next/example/app/components'
 @ ./app/components/YetAnotherComponent.js 11:20-44
 @ ./app/components/View.js
 @ ./app/components/App.js
 @ ./app/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./app/main.js

When I dig through the webpack transpiled code I see a bunch of other modules (i.e. I18nextProvider but not react-i18next.

You can see my fork here: https://github.com/nicolechung/react-i18next/commit/9a2e90a551875ebe2772d4408483e1d0bfbff875

It would be great if you can have a webpack 1 sample AND a webpack 2 sample.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
jamuhlcommented, Mar 12, 2017

did you change https://github.com/i18next/react-i18next/blob/master/example/package.json#L29 to not using the build file but the version published on npm? "react-i18next": "^2.0.0"

the sample will be updated to webpack2 when i find the time - webpack1 got deprecated the last days - so no sense in keeping a sample for webpack1.

1reaction
nicolechungcommented, Mar 18, 2017

Yes! That totally works!

Do you have a lot of Typescript users, should I file a PR to update the docs for Typescript people?

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack-dev-server Cannot find module 'webpack'
npm install --save-dev webpack-dev-server ... I had the same problem, but I resolved by installing additional webpack-cli npm install --save-dev webpack-cli.
Read more >
To v5 from v4 - webpack
This guide aims to help you migrating to webpack 5 when using webpack directly. If you are using a higher level tool to...
Read more >
Webpack - npm
webpack. Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also...
Read more >
How to fix Error: cannot find module "webpack" - Educative.io
Solution · 1. Install webpack in the local app folder · 2. Link webpack to your project.
Read more >
webpack Tutorial: How to Set Up webpack 5 From Scratch
If you're upgrading from webpack 4 to webpack 5, here are a few notes: ... failed to load and could not find module...
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