如何清除以下npm安装错误?

时间:2020-01-08 05:50:30

标签: node.js angular reactjs npm webpack

我正在尝试运行以下项目:
https://github.com/kentcdodds/react-in-angular
此仓库只是在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 --content-base应用程序:

validateSchema is not a function

如何解决?

4 个答案:

答案 0 :(得分:1)

尝试关注

1)卸载以下软件包:

npm卸载webpack webpack-dev-server --save -dev

2)安装以下软件包:

npm install --save -dev webpack@3.10.0

npm install --save -dev webpack-cli@2.0.10

npm install --save -dev webpack-dev-server@2.9.7

答案 1 :(得分:1)

您收到的npm日志不是错误,并且可能与执行代码时收到的javascript错误无关。

NPM日志仅指的是由于当前操作系统而被跳过的可选依赖项,以及安全审计(建议予以修复,但不影响执行)。

答案 2 :(得分:0)

结束您提供的信息后,我建议尝试使用作为应用程序一部分安装的webpack-dev-server来运行它,而不是在全球范围内使用的webpack-dev-server。将"start": "webpack-dev-server --content-base app"添加到package.json并在根文件夹中使用npm start对我有用。

基于webpack.validateSchema is not a function

答案 3 :(得分:-1)

尝试在计算机上重新安装新版本的nodejs

Node js file download direction

(不使用Power Shell进行安装,而是使用可视代码运行npm install)