简体   繁体   English

npm 安装在反应项目中抛出一堆错误

[英]npm install throws a bunch of errors in react project

I'm currently learning how to work with React and everytime I try to work on a course file and run npm install I get back a million errors and warning.我目前正在学习如何使用 React,每次我尝试处理课程文件并运行npm install我都会收到一百万个错误和警告。 On literally every file I try this on.在我尝试的每个文件上。 I've made sure I'm inside the right directory and that there is a json file.我已经确定我在正确的目录中并且有一个 json 文件。

    gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jessiematias/Downloads/hooks-videoplayer-starterfiles-master/react-hooks-videoplayer-START/node_modules/webpack-dev-server/node_modules/fsevents
gyp ERR! node -v v12.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 

I've already tried to reinstall node, update npm to latest version (i'm on 6.14.4) and run npm cache clean but none of those worked.我已经尝试重新安装节点,将 npm 更新到最新版本(我在 6.14.4 上)并运行 npm 缓存清理但这些都不起作用。 The only thing that worked once was to run a command that was something along the lines of npm install missing dependencies but that's not it, i can't remember it or find it anywhere online now.唯一有效的方法是运行类似于npm install missing dependencies的命令,但不是这样,我不记得它或现在在网上的任何地方都找不到它。

You are having a problem with the C compiler of node.您遇到了节点的 C 编译器的问题。 Often, this module ( node-gyp ) is a dependency of one of your dependencies.通常,此模块 ( node-gyp ) 是您的依赖项之一的依赖项。 The problem usually occurs, if not all settings are correctly set.如果未正确设置所有设置,通常会出现此问题。 Follow the official installation guide of node-gyp :按照node-gyp的官方安装指南:

You need to install node-gyp您需要安装node-gyp

npm install -g node-gyp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM