Vue-cli: Cannot find module 'webpack/lib/RequestShortener'

Created on 18 Sep 2018  路  6Comments  路  Source: vuejs/vue-cli

Version

3.0.3

Reproduction link

https://github.com/vuejs/vue-cli

Node and OS info

Node 8.12.0 / NPM 6.4.1 / Windows 10

Steps to reproduce

  1. Create a new project using the steps at: https://cli.vuejs.org/guide/creating-a-project.html
  2. Choose the following features for a custom build:

    • Babel

    • Router

    • Vuex

    • CSS Pre-processors

    • Linter / Formatter

    • Unit Testing

  3. Choose these answers to each question in the CLI questions:

    • Use history mode for router? --- Yes

    • Pick a CSS pre-processor: --- Sass/SCSS

    • Pick a linter / formatter config: --- ESLint + Standard config

    • Pick additional lint features: --- Lint on Save

    • Pick a unit testing solution: --- Mocha + Chai

    • Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? --- In dedicated config files

    • Save this as a preset for future projects? --- N

  4. Run the following command: vue-cli-service serve --mode development

What is expected?

The Vue CLI should set the mode as development and serve the application.

What is actually happening?

The following error / stacktrace is thrown / shown:

vue-cli-service serve --mode development

INFO Starting development server...
ERROR Error: Cannot find module 'webpack/lib/RequestShortener'
Error: Cannot find module 'webpack/lib/RequestShortener'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (C:\codebase\<>\src\uinode_modules\friendly-errors-webpack-plugin\srccore\extractWebpackError.js:4:26)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! <>@0.0.1 dev: vue-cli-service serve --mode development
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the <>@0.0.1 dev 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\<>\AppData\Roamingnpm-cache_logs\2018-09-18T14_15_04_460Z-debug.log


If needed, I can provide the log file for additional details.

needs reproduction

Most helpful comment

@LinusBorg => We can go ahead and close this issue. I apologize for opening it. I am not sure of the reason, but the issue seems to have been resolved after I deleted the node_modules directory and the package-lock.json file and re-ran the NPM installation process.

I appreciate you taking the time to respond!

All 6 comments

It would be easier for us to replicate the problem. If you provided a repository with a reproduction.

Your instructions, for example, don't mention which css pre processor etc. you chose.

@LinusBorg => We can go ahead and close this issue. I apologize for opening it. I am not sure of the reason, but the issue seems to have been resolved after I deleted the node_modules directory and the package-lock.json file and re-ran the NPM installation process.

I appreciate you taking the time to respond!

I just came across this error in a typescript create-react-app.

Then you should probably post in their repository.

For me too, the issue seems to have been resolved after I deleted the node_modules directory and the package-lock.json file

Maybe its time to switch to yarn?

Just in case you think it was a one-off. Its likely to pop up again in Vue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DrSensor picture DrSensor  路  3Comments

csakis picture csakis  路  3Comments

eladcandroid picture eladcandroid  路  3Comments

CodeApePro picture CodeApePro  路  3Comments

Gonzalo2683 picture Gonzalo2683  路  3Comments