Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何完全卸载npm安装的所有内容(即如何确保新安装的npm)?_Node.js_Angular_Npm - Fatal编程技术网

Node.js 如何完全卸载npm安装的所有内容(即如何确保新安装的npm)?

Node.js 如何完全卸载npm安装的所有内容(即如何确保新安装的npm)?,node.js,angular,npm,Node.js,Angular,Npm,我在Angular、ng等方面遇到一些版本问题。我想从头开始,卸载所有已安装的内容,然后重新开始。我在窗户上 我在这里找到了一些信息: 我从命令行运行此命令,但它似乎没有任何作用: npm卸载npm-g 我以管理员的身份重新运行,它删除了我安装的一些东西,但不是全部 这是来自cmd,不带管理员: C:\>npm uninstall npm -g up to date in 0.12s C:\>ng version _ _

我在Angular、ng等方面遇到一些版本问题。我想从头开始,卸载所有已安装的内容,然后重新开始。我在窗户上

我在这里找到了一些信息:

我从命令行运行此命令,但它似乎没有任何作用: npm卸载npm-g

我以管理员的身份重新运行,它删除了我安装的一些东西,但不是全部

这是来自cmd,不带管理员:

C:\>npm uninstall npm -g
up to date in 0.12s

C:\>ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.1.1
Node: 12.16.2
OS: win32 x64

Angular: 9.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.1
@angular-devkit/build-angular     0.901.1
@angular-devkit/build-optimizer   0.901.1
@angular-devkit/build-webpack     0.901.1
@angular-devkit/core              9.1.1
@angular-devkit/schematics        9.1.1
@angular/cdk                      7.3.7
@angular/material                 7.3.7
@ngtools/webpack                  9.1.1
@schematics/angular               9.1.1
@schematics/update                0.901.1
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0
这是以管理员身份运行后剩下的内容:

c:\>ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.1.1
Node: 12.16.2
OS: win32 x64

Angular:
...
Ivy Workspace:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.901.1
@angular-devkit/core         9.1.1
@angular-devkit/schematics   9.1.1
@schematics/angular          9.1.1
@schematics/update           0.901.1
rxjs                         6.5.4


c:\>

package.json文件中的这些命令可能会派上用场。您也可以手动删除node_modules文件夹,在package.json中调整依赖项并重新安装

"build": "npm build",
"clean": "rm -rf node_modules", 
"reinstall": "npm run clean && npm install", 
"rebuild": "npm run clean && npm install && npm run build",
编辑:我忘了在windows中输入clean命令:
“clean”:“rmdir/s/q节点\u模块”

此外,如果您的问题是全局angular/cli软件包,您可以:
npm uninstall-g angular cli
卸载angular/cli。
npm cache clean
从用户名下的应用程序数据文件夹中清除npm缓存。 使用
npm cache verify
验证缓存是否已损坏。 使用
npm cache verify--force
从系统中清除整个缓存

注: 您还可以通过以下路径进行删除 C:\Users\“您的系统用户名”\AppData\Roaming\npm和 C:\Users\“您的系统用户名”\AppData\Roaming\npm缓存 然后使用以下命令在系统中全局安装最新的angular/cli版本。
npm安装-g@angular/cli@latest

如果您面临angular/cli问题,请使用以下命令: npm uninstall-g angular cli以卸载angular/cli。 npm cache clean可从用户名下的应用程序数据文件夹中清除npm缓存。 使用npm cache verify验证缓存是否已损坏。 使用npm cache verify--强制从系统中清除整个缓存


注意:如果上述命令不起作用,请尝试使用-f或-force标志

我认为部分问题在于我不理解全局安装和特定于我当前项目的安装之间的区别。我开始深入研究这个:。有没有其他的参考资料可以详细解释每个命令的作用?你用a-g添加的任何东西都是全局的。他们通常需要直接快速入门,比如创建react应用程序。您的package.json中的依赖项特定于您的项目,devdependency仅在开发模式下可用,不会在生产环境中安装。简而言之,这些都是命令。