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

How to implement a password strength detector in react

Table of contents Preface use Component Writing D...

Using JavaScript difference to implement a comparison tool

Preface At work, I need to count the materials su...

Linux Check the installation location of the software simple method

1. Check the software installation path: There is...

vue-cropper component realizes image cutting and uploading

This article shares the specific code of the vue-...

Example code for implementing bottom alignment in multiple ways with CSS

Due to the company's business requirements, t...

Detailed explanation of mktemp, a basic Linux command

mktemp Create temporary files or directories in a...

How to view the running time of MySQL statements through Query Profiler

The previous article introduced two methods to ch...

MySQL integrity constraints definition and example tutorial

Table of contents Integrity constraints Definitio...

Write a dynamic clock on a web page in HTML

Use HTML to write a dynamic web clock. The code i...

MySQL query specifies that the field is not a number and comma sql

Core SQL statements MySQL query statement that do...

Detailed tutorial on installing Docker and nvidia-docker on Ubuntu 16.04

Table of contents Docker Installation Nvidia-dock...

Perfect solution for JavaScript front-end timeout asynchronous operation

Table of contents What happens if a piece of code...

Vue+swiper realizes timeline effect

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

CSS scroll bar style modification code

CSS scroll bar style modification code .scroll::-...

Solution to Nginx SSL certificate configuration error

1. Introduction When a web project is published o...