Preface
During the front-end development process, during npm operations, such as npm install, a series of errors will occur, causing the operation to fail. At this time we can deletenode_modulesFolders can resolve this issue.
SyntaxError: Unexpected token >
at Module._compile (internal/modules/cjs/:721:23)
at ._extensions..js (internal/modules/cjs/:787:10)
at (internal/modules/cjs/:653:32)
at tryModuleLoad (internal/modules/cjs/:593:12)
at ._load (internal/modules/cjs/:585:3)
at (internal/modules/cjs/:690:17)
at require (internal/modules/cjs/:25:18)
at Object.<anonymous> (E:\project\node_modules\webpack-dev-server\bin\:12:21)
at Module._compile (internal/modules/cjs/:776:30)
at ._extensions..js (internal/modules/cjs/:787:10)
operate
Windows system
We will find that it takes 10 minutes to half an hour to delete the node_modules folder directly under Windows or cannot be deleted.
reason:
1. Too many directories or too deep levels lead to slow deletion or cannot be recursively deleted.
2. Windows will remind you that there is no permission.
Solution:
Method 1: Enter the directory where the project is located and use the CMD command to enter the DOCS console to execute the following commands to quickly delete it.
rd /s /q node_modules
Method 2: Use PowerShell or git bash to enter the command console and execute the following commands to quickly delete (Recommended, faster)。
rm -rf ./node_modules
Method 3: Use npm's rimraf tool to implement it directly in the projectDelete in seconds(Requires installation of the library)
npm install rimraf -g
rimraf node_modules
Linux system
Method 1: Use the rm command to achieve fast recursive deletion
rm -rf ./node_modules
Method 2: Use npm's rimraf tool to implement it directly in the projectDelete in seconds(Requires installation of the library)
npm install rimraf -g
rimraf node_modules
Conclusion
Hope it will be helpful to everyone. If there is anything wrong, please point it out!