Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename an Angular project?

Tags:

angular

I renamed my Angular 4 project folder from auction-life to auction-05-life and replaced 3 occurrences of the old project name in:

  • angular-cli.json Line 4
  • app.e2e-spec.ts Line 3
  • package.json Line 2

I then ran ng serve and got this:

You seem to not be depending on "@angular/core". This is an error.

Edit: Following the instructions in the comments below, I restarted the terminal window, ensured I was in the correct project folder auction-05-life, ran npm install then ng serve and this time got a different exception:

module.js:471     throw err;     ^ Error: Cannot find module 'heimdalljs-logger'     at Function.Module._resolveFilename (module.js:469:15)     at Function.Module._load (module.js:417:25) ... 
like image 727
Liwy Avatar asked Aug 26 '17 04:08

Liwy


People also ask

Can I rename angular project?

Search in your project wherever the old name is used. In Visual Studio Code search can be done by using the search bar provided. Replace old name with your new name. Rename the project folder name as well and you are done.

How do I rename a project name?

Renaming Projects Right-click the root folder of your project and select Refactor | Rename from the context menu or press Shift+F6 . In the dialog that opens, choose the rename strategy. If the project name is the same as the name of its root folder, select Rename directory.

How do I rename a project folder?

Right click the namespace → Rename.... This should search and replace all references to your namespace throughout the project. Close the project → rename the project folder.

Can we rename angular component?

Use 'Rename Symbol' command With the cursor at the Component class, open Command Palette in VSCode with cmd+shift+p . Select “Rename Symbol” command and change the class name. VSCode will change the class name, and update all the references to this class in other files.


1 Answers

  1. Search in your project wherever the old name is used.
  2. In Visual Studio Code search can be done by using the search bar provided.
  3. Replace old name with your new name.
  4. Rename the project folder name as well and you are done.
  5. If some error occurs while running your project , delete the node_modules and do "npm install".Everything will be fine and running again.
like image 192
daksh khetarpal Avatar answered Oct 04 '22 07:10

daksh khetarpal