Converting an existing angular 2 project to use angular CLI

后端 未结 4 1740
萌比男神i
萌比男神i 2021-01-01 10:23

I have a project that was not created using ng new (rather, I followed the quickstart guide). When I run an angular CLI command in that project (such as n

4条回答
  •  一向
    一向 (楼主)
    2021-01-01 11:00

    Try the below solution may be it could help.

    1. Run this command on root folder npm install -g angular-cli
    2. Create new folder for your project ng new project_folder_name
    3. Enter inside that folder cd project_folder_name
    4. Run the project by this command ng serve (Note: Now on localhost:4200, the demo project will run)
    5. Copy the src folder of your existing project and replace with the src of your newly created project from project's root folder only.

    Copy everything from package.json from the existing project. Run npm install again.If it breaks, it probably needs tinker with webpack.config

提交回复
热议问题