Solution to Vue3.0 error Cannot find module'worker_threads'

Solution to Vue3.0 error Cannot find module'worker_threads'

I'll record my first attempt at vue3.0. When I started the project, I got an error message saying "Cannot find module 'worker_threads'". I checked and found that it was because the node version on my computer was too low. I checked the version.

node -v
v11.2.0

Then upgrade your node version and execute the startup command.

npm install -gn (remember to add sudo on Mac)
latest

Summary: You need to upgrade node.js to version 12 or above to solve the problem of Vue3.0 reporting the error Cannot find module 'worker_threads'.

Further reading: Solution to the error Cannot find module 'xxx'.

When packaging with webpack, there will be an error of Cannot find module 'XXX', which means that a certain module cannot be found. Here is a solution:

Directly perform npm install to repackage;

If this problem still occurs after npm install repackaging, you can delete the node_modules folder and clear the cache at the same time, as follows:

rm -rf node_modules

npm cache clean --force

npm install

The above is the editor's introduction to the solution of Vue3.0 error Cannot find module 'worker_threads'. I hope it will be helpful to everyone. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Vue——Solving the error Computed property "****" was assigned to but it has no setter.
  • Solve the problem of Cannot find module 'chalk' error in Vue project
  • Solve the error problem of warnings potentially fixable with the `--fix` option when running a Vue project

<<:  Graphic tutorial on installing MySQL database and configuring environment variables on Mac

>>:  Detailed explanation of the application of meta tags in mobile platform development

Recommend

Centos7 installation of FFmpeg audio/video tool simple document

ffmpeg is a very powerful audio and video process...

Tutorial on building nextcloud personal network disk with Docker

Table of contents 1. Introduction 2. Deployment E...

Detailed explanation of Vue's list rendering

Table of contents 1. v-for: traverse array conten...

Several methods of calling js in a are sorted out and recommended for use

We often use click events in the a tag: 1. a href=...

CSS to achieve text on the background image

Effect: <div class="imgs"> <!-...

Detailed explanation of the functions and usage of MySQL common storage engines

This article uses examples to illustrate the func...

ie filter collection

IE gave us a headache in the early stages of deve...

How to compare two database table structures in mysql

During the development and debugging process, it ...

Writing and understanding of arrow functions and this in JS

Table of contents Preface 1. How to write functio...

vue+element-ui implements the head navigation bar component

This article shares the specific code of vue+elem...

Vue+thinkphp5.1+axios to realize file upload

This article shares with you how to use thinkphp5...