nodemon报错Uncaught ReferenceError: process is not defined

Project scenario:

Use electron+vue3+vue-router to develop the desktop, start vue-router error reading parent of undefined, then nodemon error Uncaught ReferenceError: process is not defined


Problem Description

When developing electron, I suddenly found that vue-router could not jump correctly.

Find the source code file of nodemon, and find that the place where the process reports an error is to call process.version to get the version number, which is the built-in api of node.
The project has been available in the past, so there is no problem with the node version, so it can only be a problem with nodemon.


Cause Analysis:

I remove the router-view tag, write some content casually, and it can be displayed correctly. So I tracked down the index.js file under the router, and found that the break point could not enter this file, so there is a bug somewhere in this js file. Then block by block of code to locate the problem, and found that at some point, a method of nodemon was introduced. (This file will not introduce this method under normal circumstances)

It may be that when I downloaded a certain plug-in, I depended on nodemon, causing its version to be wrong? But I should not modify my router entry file. It has been impossible to reproduce the scene where this problem occurred, so the cause of this problem cannot be fully determined.

But with a high probability, it is certain that there is a problem with the nodemon version, and the reason why the router reports an error is that the nodemon API is introduced into its index.js.


solution:

  1. The first step is to delete the code about nodemon in index.js under the router folder.
  2. The second step is to update the nodemon version.

problem solved.

Guess you like

Origin blog.csdn.net/zjsj_lize/article/details/130238507