Angular's project creation error: setTimeout is not defined

Babies with zero foundation, follow the video to learn Angular, and will teach you how to create a new project.
However, when operating, you will encounter problems that cannot be created.
Next, let's take a look at the problem of getting stuck at the door of my house when Angular started.

In the case that nodejs has been installed, it is recommended to use the cnpm command to install Angular CLI globally
cnpm install -g @angular/cli

It goes like this
insert image description here
Check Angular version
cnpm install -g @angular/cli

insert image description here
It seems that there is no problem.
Let’s continue.
Now let’s use the command to create an Angular local running project, choose the content you want to configure,
ng new my-project-name
insert image description here
is configured, and then ENTER to load the project, but you will find that insert image description here
setTimeout is not defined and an error will be reported.
No matter how you change the configuration options, an error will be reported!
Here is the answer, don't want to read and continue to pay
attention! The reason for the error is that the cnpm installation was used. Therefore, you need to uninstall Angular and download it with npm again before you can use it.
uninstall angular/cli
insert image description here

npm uninstall -g @angular/cli Uninstall scaffolding

npm install -g @angular/cli install scaffolding

ng new my-project Create angular project
Done!
insert image description here
cd my-project to open the project file
insert image description hereinsert image description here

To be continued...

Guess you like

Origin blog.csdn.net/qq_43985303/article/details/130697324