4

I'm trying to set up a project using webpack. When I try to serve it using webpack I get this:

root@d690f9010746:~/chat-webapp# npm run serve

> chat-webapp@1.0.0 serve /root/chat-webapp
> webpack serve --config webpack.config.js

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '../../lib/webpack-cli'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/root/chat-webapp/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/root/chat-webapp/node_modules/@webpack-cli/serve/index.js:4:20)
    at Module._compile (/root/chat-webapp/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chat-webapp@1.0.0 serve: `webpack serve --config webpack.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the chat-webapp@1.0.0 serve 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!     /root/.npm/_logs/2020-05-31T19_42_42_752Z-debug.log

The line /root/chat-webapp/node_modules/@webpack-cli/serve/index.js:4 (mentioned in the stacktrace) says: const WebpackCLI = require("../../lib/webpack-cli");. But I don't have the file /root/chat-webapp/node_modules/lib/webpack-cli - and even if I did, it's not in the @webpack-cli/serve repo, and the repo shouldn't be making assumptions about the locations of files it doesn't control.

And yet I can't find anyone or stackoverflow or anywhere else who's getting an error on the same relative path. So what am I missing? I've installed all the npm repos locally, which is a bit non-standard - could it be something to do with that?

David Knipe
  • 3,417
  • 1
  • 19
  • 19

0 Answers0