-
-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Cannot find module 'webpack' #299
Comments
I have a similar problem: TypeError: Cannot read property 'presetToOptions' of undefined Described by someone else on StackOverflow |
@andriibyk-apiko what version are you on? |
|
Mind printing your |
Could you do a console log before the error throws on webpack? |
Also had the same problem with "presetToOptions" as @andriibyk-apiko, but then I reinstalled webpack and then I got this error instead. Installed Webpack v.^2.0.0 instead and now it works. Don't know what prefix paths is |
|
|
[email protected] (global) Stacktrace:
|
This might be hard for me to reproduce, anyone from @webpack/core-team that can? |
@ev1stensberg - Not sure it helps, but it seems to only affect the global install. I installed webpack-cli locally and it works, but you get the "prefer global" warning. |
use |
@ashclarke that might be cause our prefer to global is wrong ( I think ), will investigate. |
@jesperlandmer @ashclarke Can you output Related PR #332. |
@dhruvdutt - |
Can you try updating? |
Not sure if this is related, but if you run Then run
Webpack was running as normal when using webpack 3 |
@quantuminformation You missed installing |
Many thanks for this! |
Is this issue still valid? |
Friendly ping @jesperlandmer |
Don’t know! I think the main issue has to do with Vagrant and how Vagrant handles global values. I had several problems with other dependencies as well (e.g. Firebase). Staying with docker from now on |
Okay. Let's keep this open for others to come to if they have similar issues! |
Same issue with the global install.
|
@ev1stensberg any updates? Installing webpack and webpack-cli locally doesn't work for me, and neither does |
I uninstalled globally |
Working on fixing this but haven’t had a lot of spare time lately. Sorry for the inconviniences.. 👨🏼🔧 |
@ev1stensberg in the meantime, what should I do to follow best practices with my projects? |
Anything that runs webpack is viable. Ideal case is to run it through node modules by installing them both locally as devDeps. If that doesn’t work, then look in the issue thread 🤗 |
Many thanks, it worked! |
OP appears to be using Unix, but I had the same error after multiple project restarts/npm installs. For those using WSL / Bash for Windows I noticed sometimes
Spent half a day trying to figure this out and ran through most of the suggestions here, hopefully it helps someone. |
I only got it to work by first install npm install -g webpack-cli and then npm install -g webpack. |
Thanks! This worked for me too! |
Note: installing webpack globally is not recommended. |
npm i -D webpack-cli Worked for me. |
Same issue, deleting node_modules and package-lock then npm install - worked for me
|
This worked for me in the way that it then did found finally the webpack-cli module but then I got this warnings and error: WARNING in configuration ERROR in multi ./app.js bundle.js |
I solved my last issue thanks to this : https://stackoverflow.com/questions/49389677/module-not-found-error-cant-resolve-bundle-js-in-users-jonathankuhl-docum |
You can try running webpack directly from the node_modules folder, this seems to solve a lot of the red errors in the terminal.
And if you don't want to keep typing that line you can add a build script in your package.json file |
npm link webpack |
I likely cannot provide much insight but this was affecting me not locally on macOS but on my continuous integration provider linux/Ubuntu, after debugging with SSH in the CI, I found out that webpack-cli 3.2.0 was the first version to introduce this issue, so I downgraded it to 3.1.2 in my - "webpack-cli": "3.2.0",
+ "webpack-cli": "3.1.2", And it worked! I also tried many webpack 4.X and they all seemed to work with cli 3.1.2. CI debugging data:
|
Have you tried updating to the latest CLI version? Is the issue still persistent? |
Yes, i also tried the latest version, forgot to mention it.
…On Wed, May 29, 2019, 3:57 AM Even Stensberg ***@***.***> wrote:
Have you tried updating to the latest CLI version? Is the issue still
persistent?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#299?email_source=notifications&email_token=AAAO4CGJVB5TJRDYZYTXUXLPXYZPXA5CNFSM4ETAZQV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWOP67A#issuecomment-496828284>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAO4CESOUDV7BYUQ54REHDPXYZPXANCNFSM4ETAZQVQ>
.
|
Alright. Aware this is a bug, but the bug is due the fact that you have a global and a local installation or vice versa. Could you try aligning CLI installation location with webpack location? |
Hey, got a new machine and I don't have webpack and webpack-cli installed globally; Debugging at the moment but seems that the reports above are correct, the bug still persists; I'll update the comment with more info after I fully understand what's going on. The following is for a project that has a dependecy
these are all the globals I have installed in the machine
Decided to cd into node_modules/foobar and tried:
During npm install outside the node_modules/foobar I do get "One CLI for webpack must be installed...", which I accept but in the end there's the error I've reported earlier or at the top Error: Cannot find module 'webpack-cli'
Fixed after:
|
#299 (comment) |
i was getting the same error " [Bug]: Cannot find module 'webpack' "
Step-2: uninstall Webpack
step-3: Delete node-module folder from your project directory
step-4: Run npm install
step-5: Run yarn command
step-6: Run start command
or
This is working for me |
So, I tried about everthing in this thread:
No luck!! Only directly running with Maybe a bug with > 91 comments is an indication?? |
Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks! If somebody faced with the problem again please open the new issue with reproducible example, I think we fixed it (please use |
i was able to solve this problem in fedora 33 this way:
|
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Whenever I try to run
webpack
, I get this error message:If the current behavior is a bug, please provide the steps to reproduce.
I'm using Vagrant, and just installed webpack and webpack cli globally.
Using:
node.js: v8.9.4
npm: v5.6.0
webpack: v4.0.1
webpack-cli: v2.0.9
What is the expected behavior?
To bundle the files
Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.
I'm using Typescript and React on a Node machine. Vagrant runs on Ubuntu
The text was updated successfully, but these errors were encountered: