NodeJS WARN已弃用请求@2.88.2:请求已被弃用,npm WARN弃用har-validator@5.1.5

llycmphe  于 2023-06-05  发布在  Node.js
关注(0)|答案(3)|浏览(619)

我尝试使用npm install -g @angular/cli安装angular/cli,但它一直向我发送警告

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
C:\Users\amsmk\AppData\Roaming\npm\ng -> C:\Users\amsmk\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng

> @angular/cli@10.0.7 postinstall C:\Users\amsmk\AppData\Roaming\npm\node_modules\@angular\cli
> node ./bin/postinstall/script.js

+ @angular/cli@10.0.7
added 281 packages from 206 contributors in 74.68s

我该怎么补救

jgwigjjp

jgwigjjp1#

这对我很有效。(刷新所有依赖项)
1.清除节点缓存文件。删除../AppData/Roaming中的这些文件夹npmnpm-cache
1.再次全局安装angular CLI。npm install -g @angular/cli
参考文献:
https://docs.npmjs.com/cli/v7/configuring-npm/folders
Can't create a new angular project

zlwx9yxi

zlwx9yxi2#

将你的测试框架从protractor迁移到其他框架(我更喜欢cypress),然后从你的项目中卸载protractor,那么弃用的requesthar-validator将得到解决。(https://www.npmjs.com/package/protractor?activeTab=versionshttps://blog.angular.io/the-state-of-end-to-end-testing-with-angular-d175f751cb9c,https://docs.cypress.io/guides/end-to-end-testing/protractor-to-cypress#Getting-Started)
步骤1:使用以下命令安装cypress

ng add @cypress/schematic

步骤2:迁移所有测试cypress
步骤3:使用以下命令卸载量角器

npm uninstall protractor

然后删除node_modules和package-lock.json文件
步骤4:使用以下命令再次安装node_modules

npm i or npm install

现在,已弃用的警告将得到解决并从项目中删除

jfgube3f

jfgube3f3#

我用这个命令解决了

npm install --no-fund -g <name>

相关问题