如何在npm项目中findnode-gyp依赖(..或任何依赖)

我正在经历难以想象的挫折,试图让一个项目运行(即通过调用“npm install” ),总是跳过node-gyp 。 我在Windows上,所以我需要安装Python和类似Visual Studio的东西。

长话短说…我不想依赖于像Visual Studio那样的一堆烂堆,所以我想看看这个node-gyp是否可以以某种方式成为可选的,或者被删除掉。

现在,如果我打开我的package.json文件,我发现这些依赖关系。

"devDependencies": { "autoprefixer-stylus": "^0.7.1", "browser-sync": "^2.8.2", "gulp": "^3.9.0", "gulp-cache": "^0.3.0", "gulp-concat": "^2.6.0", "gulp-if": "^1.2.5", "gulp-imagemin": "^2.3.0", "gulp-minify-html": "^1.0.4", "gulp-nunjucks-html": "^1.2.2", "gulp-order": "^1.1.1", "gulp-plumber": "^1.0.1", "gulp-stylus": "^2.0.6", "gulp-uglify": "^1.2.0", "gulp-util": "^3.0.6", "jeet": "^6.1.2", "kouto-swiss": "^0.11.13", "minimist": "^1.1.3", "rupture": "^0.6.1" }, "dependencies": { "gulp-install": "^0.6.0" } 

我可以在这里看到每个包的依赖关系树:

http://npm.anvaka.com/#/

但是,如果我经历了这些依赖关系中的每一个依赖关系,我无法在任何地方看到node-gyp依赖关系。

有什么我不明白的依赖关系? 什么使用node-gyp? 为什么?

find它的依赖关系

 npm ls node-gyp 

natice C / C ++附加程序需要node-gyp,如文档中所述

依赖关系build立在每个目标平台上。 对于Windows平台,它需要在这里的安装说明中提到的visual studio

node-gyp本身在package.json没有被提及(可能是因为它需要全局安装),所以你必须手工查看依赖关系或者它的嵌套依赖关系是否使用了本地c / c ++插件的repo或者下载的源代码代码或npm安装日志本身。 一种方法可能是在npm_modules文件夹中search文件binding.gyp或.cc/.cpp文件,并且您应该能够find罪魁祸首npm模块。

npm ls在您的项目中列出已安装的依赖关系。 npm ls node-gyp将限制node-gyp的子树。

npm-remote-ls列出远程软件包的所有依赖关系。 你手动通过或使用grep

我创build了比这两个(为此目的)快得多的findep 。 它可以检查你的本地项目,一个外部的npm包,甚至是一个远程的github项目,并且有一个--greedy选项,一find指定的依赖关系就会停止。

 # Checks if current project has a 'node-gyp' dependency findep node-gyp # Checks if the npm package 'node-sass' has a 'node-gyp' dependency findep node-gyp -e node-sass # Greedily checks if the project 'AngularClass/angular2-webpack-starter' has at least one of these dependencies including "devDependencies": $ findep he mime lodash ms -GDr -e AngularClass/angular2-webpack-starter Looking for [he, mime, lodash, ms] in AngularClass/angular2-webpack-starter... Found 16 dependencies that use [he, mime, lodash, ms]: assets-webpack-plugin > lodash string-replace-loader > lodash karma-coverage > lodash 

node-gyp用于编译节点的本机插件模块。 你有没有看过这里的文档,特别是Windows的信息? 另外,看看这个问题的方式围绕Visual Studio的要求