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.

run webpack-dev-server

See original GitHub issue

Attempting to run webpack-dev-server --inline results in:

`[root@localhost vue]# webpack-dev-server
 http://localhost:8080/
webpack result is served from /static/build/
content is served from /vagrant/vue
404s will fallback to /index.html
Hash: 1783784827fcdfaf2e1c
Version: webpack 1.12.14
Time: 1346ms
    Asset      Size  Chunks             Chunk Names
detail.js   74.6 kB       0  [emitted]  detail
  home.js   74.7 kB       1  [emitted]  home
 home.css  48 bytes       1  [emitted]  home
chunk    {0} detail.js (detail) 49.9 kB [rendered]
    [0] multi detail 52 bytes {0} [built]
    [1] (webpack)-dev-server/client?http://localhost:8080 3.97 kB {0} {1} [built] [1 error]
    [2] (webpack)/~/node-libs-browser/~/url/url.js 22.3 kB {0} {1} [built]
    [3] (webpack)/~/node-libs-browser/~/punycode/punycode.js 14.7 kB {0} {1} [built]
    [4] (webpack)/buildin/module.js 251 bytes {0} {1} [built]
    [5] (webpack)/~/node-libs-browser/~/querystring-es3/index.js 127 bytes {0} {1} [built]
    [6] (webpack)/~/node-libs-browser/~/querystring-es3/decode.js 2.51 kB {0} {1} [built]
    [7] (webpack)/~/node-libs-browser/~/querystring-es3/encode.js 2.54 kB {0} {1} [built]
    [8] (webpack)-dev-server/client/socket.js 856 bytes {0} {1} [built] [1 error]
    [9] (webpack)/hot/dev-server.js 1.85 kB {0} {1} [built]
   [10] (webpack)/hot/log-apply-result.js 813 bytes {0} {1} [built]
   [11] ./js/detail.js 18 bytes {0} [built]
chunk    {1} home.js, home.css (home) 50 kB [rendered]
    [0] multi home 52 bytes {1} [built]
    [1] (webpack)-dev-server/client?http://localhost:8080 3.97 kB {0} {1} [built] [1 error]
    [2] (webpack)/~/node-libs-browser/~/url/url.js 22.3 kB {0} {1} [built]
    [3] (webpack)/~/node-libs-browser/~/punycode/punycode.js 14.7 kB {0} {1} [built]
    [4] (webpack)/buildin/module.js 251 bytes {0} {1} [built]
    [5] (webpack)/~/node-libs-browser/~/querystring-es3/index.js 127 bytes {0} {1} [built]
    [6] (webpack)/~/node-libs-browser/~/querystring-es3/decode.js 2.51 kB {0} {1} [built]
    [7] (webpack)/~/node-libs-browser/~/querystring-es3/encode.js 2.54 kB {0} {1} [built]
    [8] (webpack)-dev-server/client/socket.js 856 bytes {0} {1} [built] [1 error]
    [9] (webpack)/hot/dev-server.js 1.85 kB {0} {1} [built]
   [10] (webpack)/hot/log-apply-result.js 813 bytes {0} {1} [built]
   [12] ./js/home.js 48 bytes {1} [built]
   [13] ./css/home.css 41 bytes {1} [built]

ERROR in (webpack)-dev-server/client?http://localhost:8080
Module not found: Error: Cannot resolve module 'strip-ansi' in /tmp/no_manage/node_modules/webpack-dev-server/client
 @ (webpack)-dev-server/client?http://localhost:8080 2:16-37

ERROR in (webpack)-dev-server/client/socket.js
Module not found: Error: Cannot resolve module 'sockjs-client' in /tmp/no_manage/node_modules/webpack-dev-server/client
 @ (webpack)-dev-server/client/socket.js 1:13-37
Child extract-text-webpack-plugin:
    chunk    {0} extract-text-webpack-plugin-output-filename 1.74 kB [rendered]
        [0] /tmp/no_manage/~/css-loader!./css/home.css 230 bytes {0} [built]
        [1] /tmp/no_manage/~/css-loader/lib/css-base.js 1.51 kB {0} [built]
webpack: bundle is now VALID.
`

why ? Cannot resolve module ‘sockjs-client’ and Cannot resolve module ‘strip-ansi’

[root@localhost client]# ls index.bundle.js live.bundle.js live.js socket.js web_modules index.js live.html page.jade style.css webpack.config.js

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
angusjiangcommented, Nov 4, 2016

I got it, use “webpack-dev-server --host 0.0.0.0 --port 8080 --inline --hot --quiet” instead of “webpack-dev-server”.

and add two attribute :

 watch: true,

watchOptions: {
  poll: true
},

so, it works… Thank you again for guidance.

1reaction
SpaceK33zcommented, Nov 1, 2016

@angusjiang, ah I think I know where your problem is.

In your webpack config, you have this:

resolve: {
        modulesDirectories: ['.']
},

However, that isn’t valid and by specifying the modulesDirectories without node_modules in it, the client script can’t compile. For more information why . is not valid, see the docs.

So to fix it, I would suggest to either remove modulesDirectories, or to add 'node_modules' to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Development | webpack
Let's start by setting mode to 'development' and title to 'Development' . webpack.config.js ... Let's add a script to easily run the dev...
Read more >
webpack-dev-server - npm
Use webpack with a development server that provides live reloading. This should be used for development only. It uses webpack-dev-middleware ...
Read more >
Webpack Dev Server - GitHub
Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server. Options: -c, --config <value...> Provide path to a webpack configuration file ...
Read more >
Webpack Dev Server - Imran Sayed
When you run webpack dev server what webpack dev server does is, instead of creating a bundled file ( e.g. bundle.js ) in...
Read more >
How to setup your perfect Webpack dev server environment ...
Why use Webpack dev server? · Create index.html file and public directory · Setup package.json file and install dev dependencies · Create helper...
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