如何重命名Angular项目? [英] How to rename an Angular project?

查看:397
本文介绍了如何重命名Angular项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Angular 4项目文件夹从 auction-life 重命名为 auction-05-life ,并替换了出现在以下位置的3个旧项目名称:

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第4行
  • app.e2e-spec.ts第3行
  • package.json第2行

然后我运行ng serve并得到了这个信息:

I then ran ng serve and got this:

您似乎不依赖于"@ angular/core".这是一个错误.

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

编辑:按照下面的注释中的说明,我重新启动了终端窗口,确保我位于正确的项目文件夹 auction-05-life 中,并运行了然后ng serve,这次又有一个不同的例外:

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)
...

推荐答案

  1. 在使用旧名称的地方搜索您的项目.
  2. 在Visual Studio Code中,可以使用提供的搜索栏进行搜索.
  3. 用新名称替换旧名称.
  4. 也重命名项目文件夹名称,即可完成.
  5. 如果在运行项目时发生错误,请删除node_modules并 做"npm install".一切都会好起来,然后再次运行.
  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.

这篇关于如何重命名Angular项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆