webpack 如何删除下面的npm安装错误?

vsdwdz23  于 2022-11-13  发布在  Webpack
关注(0)|答案(5)|浏览(210)

我正在尝试运行以下项目:
https://github.com/kentcdodds/react-in-angular
这个repo只是一个在AngularJS中使用React的例子。有三个标签。检查它们以便看到将Angular应用程序移动到React的过程。有点有趣和东西:-)
但在npm安装后,我得到以下错误:

npm WARN rm not removing /home/user/react-in-angular/node_modules/.bin/esparse as it wasn't installed by /home/user/react-in-angular/node_modules/esprima-fb
npm WARN rm not removing /home/user/react-in-angular/node_modules/.bin/esvalidate as it wasn't installed by /home/user/react-in-angular/node_modules/esprima-fb

> kexec@1.1.0 install /home/user/react-in-angular/node_modules/kexec
> pangyp configure build

sh: 1: pangyp: not found
npm WARN react-in-angular@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@0.3.8 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@0.3.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: kexec@1.1.0 (node_modules/kexec):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: kexec@1.1.0 install: `pangyp configure build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT

added 126 packages from 149 contributors, removed 72 packages, updated 570 packages and audited 7724 packages in 10.882s

17 packages are looking for funding
  run `npm fund` for details

found 7 vulnerabilities (2 low, 5 high)
  run `npm audit fix` to fix them, or `npm audit` for details

运行npm审计后:

=== npm audit security report ===                        

                                 Manual Review                                  
             Some vulnerabilities require your attention to resolve             

          Visit https://go.npm.me/audit-guide for additional guidance           

  Low             Arbitrary File Write                                          

  Package         cli                                                           

  Patched in      >=1.0.0                                                       

  Dependency of   6to5 [dev]                                                    

  Path            6to5 > jshint > cli                                           

  More info       https://npmjs.com/advisories/95                               

  High            Regular Expression Denial of Service                          

  Package         minimatch                                                     

  Patched in      >=3.0.2                                                       

  Dependency of   6to5 [dev]                                                    

  Path            6to5 > chokidar > readdirp > minimatch                        

  More info       https://npmjs.com/advisories/118                              

  High            Regular Expression Denial of Service                          

  Package         minimatch                                                     

  Patched in      >=3.0.2                                                       

  Dependency of   6to5 [dev]                                                    

  Path            6to5 > jshint > cli > glob > minimatch                        

  More info       https://npmjs.com/advisories/118                              

  High            Regular Expression Denial of Service                          

  Package         minimatch                                                     

  Patched in      >=3.0.2                                                       

  Dependency of   6to5 [dev]                                                    

  Path            6to5 > jshint > minimatch                                     

  More info       https://npmjs.com/advisories/118                              

  Low             Prototype Pollution                                           

  Package         lodash                                                        

  Patched in      >=4.17.5                                                      

  Dependency of   6to5 [dev]                                                    

  Path            6to5 > lodash                                                 

  More info       https://npmjs.com/advisories/577                              

  High            Prototype Pollution                                           

  Package         lodash                                                        

  Patched in      >=4.17.11                                                     

  Dependency of   6to5 [dev]                                                    

  Path            6to5 > lodash                                                 

  More info       https://npmjs.com/advisories/782                              

  High            Prototype Pollution                                           

  Package         lodash                                                        

  Patched in      >=4.17.12                                                     

  Dependency of   6to5 [dev]                                                    

  Path            6to5 > lodash                                                 

  More info       https://npmjs.com/advisories/1065                             

found 7 vulnerabilities (2 low, 5 high) in 7724 scanned packages
  7 vulnerabilities require manual review. See the full report for details.

运行后,webpack-dev-server --基于内容的应用程序:

validateSchema is not a function

怎么能解决呢?

hmae6n7t

hmae6n7t1#

尝试以下操作

1)卸载以下软件包:

npm卸载webpack webpack-dev-服务器--保存-dev

2)安装以下软件包:

npm安装--保存-开发webpack@3.10.0
npm安装--保存-开发webpack-cli@2.0.10
npm安装--保存-开发webpack-dev-服务器@2.9.7

axkjgtzd

axkjgtzd2#

您收到的npm日志不是错误,并且可能与您在执行代码时收到的javascript错误无关。
NPM日志仅引用由于当前操作系统和安全审核而被跳过的可选依赖项,建议修复这些依赖项,但不应影响执行。

nwnhqdif

nwnhqdif3#

根据您提供的信息,我建议您尝试使用webpack-dev-server来运行它,它是作为应用程序的一部分安装的,而不是全局安装的webpack-dev-server。在package.json中添加"start": "webpack-dev-server --content-base app"并在根文件夹中使用npm start对我来说很有效。
基于webpack.validateSchema is not a function

7kqas0il

7kqas0il4#

在使用Angular 和其他框架时,必须使用npm命令提示符。
CMD中的输出:

--> `C:\Users\your_username> ng serve`
==>`'ng' is not recognized as an internal or external command,
      operable program or batch file.`

而Node.js命令提示符中的输出:
第一个

jw5wzhpr

jw5wzhpr5#

尝试在计算机上重新安装节点的新版本
Node js file download direction
(not使用power shell进行安装,使用可视代码运行npm安装)

相关问题