Repository navigation
Closed
Description
-
Operating System: Mac OS
-
Node Version: 10.15.1
-
NPM Version: 6.4.1
-
webpack Version: 4.34.0
-
webpack-dev-server Version: 3.2.1
-
This is a bug...?
-
This is a modification request
Code
// webpack.config.js
const path = require('path');
const config = require('./webpack.dev.config');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const newConfig = Object.assign({}, config);
newConfig.entry = ['@babel/polyfill', './app/features/Certifications/index', 'webpack/hot/only-dev-server'];
newConfig.output = {
filename: 'webpack-certifications-bundle.js',
path: path.resolve('../app/assets/webpack'),
publicPath: '/',
};
newConfig.devServer = {
historyApiFallback: true,
hot: true,
open: true,
openPage: 'dashboard',
port: 9000,
proxy: {
'/api': {
target: 'http://localhost:9010',
secure: false,
},
},
publicPath: '/',
};
newConfig.plugins.push(new HtmlWebpackPlugin());
module.exports = newConfig;
module.exports.devtool = 'cheap-module-eval-source-map';// package.json
scripts: {
"dev:cert:webpack": "NODE_ENV=development webpack-dev-server --config webpack.dev.certifications.config.js"
}Expected Behavior
Running npm run dev:cert:webpack starts webpack dev server.
Actual Behavior
~/src/projects/client$ npm run dev:cert:webpack
> [email protected] dev:cert:webpack /Users/jamie/src/projects/client
> NODE_ENV=development webpack-dev-server --config webpack.config.js
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/jamie/src/projects/client/node_modules/webpack-dev-server/bin/webpack-dev-server.js:77:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev:cert:webpack: `NODE_ENV=development webpack-dev-server --config webpack.dev.certifications.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev:cert:webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jamie/.npm/_logs/2019-06-14T23_23_20_044Z-debug.log
If I upgrade to webpack-dev-server 3.7.1, this error does not occur.
Thank you for your help.
Reacted by frames75, Bill Coloe, Kunuk Nykjær, Paul Grime, Avindra Goolcharan, Andrey Gubanov, Danila Ganchar, fatemeAfshani and Max Poliakov
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Priority
None yet
Activity
hiroppy commentedon Jun 15, 2019
hmm. webpack-cli changed a directory structure...
related: https://github.com/webpack/webpack-cli/pull/781/files#diff-2ec72bdd4a30cf784ac1e831f1360746
But, why didn't you resolve this path? I want to know your webpkack-cli's version.
https://github.com/webpack/webpack-dev-server/blob/master/bin/webpack-dev-server.js#L53
hiroppy commentedon Jun 15, 2019
I cannot reproduce this issue.
Details
alexander-akait commentedon Jun 15, 2019
You use old webpack-cli version, please update webpack-cli
jamiek-acl commentedon Jun 17, 2019
@evilebottnawi and @hiroppy I'm on the latest
hiroppy commentedon Jun 17, 2019
We cannot reproduce your issue. if we need to investigate this issue, please submit the reproducible repo.
jamiek-acl commentedon Jun 17, 2019
It looks like you used
[email protected], but I had the problem with version 3.2.1 (I am not able to upgrade).snaill commentedon Jun 19, 2019
[email protected] is OK.
snaill commentedon Jun 19, 2019
[email protected] error: Cannot find module 'yargs'
dhantke commentedon Jun 28, 2019
Same problem here.
@snaill thx for investigation!
Dheeraj-GL commentedon Oct 17, 2019
same issue on 3.8.2
sneeze-attack commentedon Oct 19, 2019
I ran into this issue after updating webpack-cli from:
webpack-cli ^3.2.1 → ^3.3.9I fixed it by changing:
node_modules\webpack-dev-server\bin\webpack-dev-server.js
Line 84:
require('webpack-cli/bin/config-yargs')(yargs);To:
require('webpack-cli/bin/config/config-yargs')(yargs);Line 92:
const config = require('webpack-cli/bin/convert-argv')(yargs, argv, {To:
const config = require('webpack-cli/bin/utils/convert-argv')(yargs, argv, {cjlarose commentedon Jan 18, 2020
Fixed in #1754. Upgrade to
webpack-dev-server3.3.0 or higher.jods4 commentedon Feb 12, 2020
This is broken again when using
webpack-cli4.0.0 (in beta). There's onlycli.jsleft insidewebpack-cli/bin.alexander-akait commentedon Feb 12, 2020
Please use
webpack servefor run webpack-dev-server21 remaining items
xdvarpunen commentedon Sep 16, 2020
I had windows update today that prevented recognizing
webpackandwebpack-cli. After finishing the update and restarting PC the project recognizedwebpackandwebpack-cliagain.harsh1612-dec commentedon Sep 19, 2020
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'webpack/bin/config-yargs'
Require stack:
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\Harsh Agarwal\Desktop\reactapp\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\Users\Harsh Agarwal\Desktop\reactapp\node_modules\webpack-dev-server\bin\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start:
webpack-dev-server --hotnpm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Harsh Agarwal\AppData\Roaming\npm-cache_logs\2020-09-19T03_56_55_540Z-debug.log
Kindly help me with this i cant find solution from past 3 days
matrunchyk commentedon Oct 4, 2020
Same to me:
Works:
matrunchyk commentedon Oct 4, 2020
@evilebottnawi wanna reopen or should I create a new issue?
GurvirSingh commentedon Oct 10, 2020
use the webpack-3.3.12 version
npm i [email protected]and it should work!dmitriid commentedon Oct 12, 2020
alexander-akait commentedon Oct 12, 2020
Need update
webpack-clito v4 (stable) and changewebpack-dev-serverbin in package.json onwebpack serve:Old:
package.json
{ "scripts": { "serve": "webpack-dev-server" }, "devDependencies": { "webpack-cli": "^3.3.12" } }New:
package.json
{ "scripts": { "serve": "webpack serve" }, "devDependencies": { "webpack-cli": "^4.0.0" } }Please read my answer careful
dmitriid commentedon Oct 12, 2020
@evilebottnawi Your answer is somewhere in the middle of 20-30 replies to this issues. It's nowhere in the README. The version didn't change, but somehow the behaviour broke due to a release of an external lib?
Dependabot has bumped cli version for quite a number of projects, so expect a lot of people flocking to this issue and potentially missing a response.
The best way to solve this is just to add a line to the README:
alexander-akait commentedon Oct 12, 2020
Yes, we are working on bugs in webpack-cli, it will be improved after this
Update webpack-cli
devenderbe commentedon Oct 14, 2020
"start": "webpack serve --mode development --open"it's working fine but without using --open. But giving error on adding --open.ekb72-B commentedon Oct 14, 2020
Hi All, having trouble with this as well.
I changed the versions to recommended ones here, but the issue persists.
renic commentedon Oct 14, 2020
running 3.3.12 resolved this for me.
npm i [email protected]BelisonRazer commentedon Oct 18, 2020
downgraded 4.x => 3.3.12, it's work