How to find the node -gyp dependency (..or any dependency) in an npm project

I am experiencing unimaginable frustration when I try to run a project (i.e. by calling 'npm install' ), which always moves through node -gyp . I am in windows, so I need to install python and something like Visual Studio.

In short ... I do not want to be dependent on a purulent heap s ***, such as Visual Studio, so I want to see how somehow this node -gyp may be somehow optional or get rid of.

Now, if I open the package.json file, I find these dependencies.

"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" } 

I can see the dependency tree of each of these packages by going here:

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

However, if I look at each of these dependencies, I cannot see the node -gyp dependency anywhere for any of them.

Is there something I don't understand about dependencies? What uses node-gyp? And why?

+5
source share
4 answers

node -gyp is required for natice C / C ++ Addition, as documented here

Dependencies are built on each target platform. Window platforms require a visual studio, as indicated in their installation notes here

node-gyp itself is not mentioned in package.json (possibly because it requires a global installation), so you will need to manually see if any of the dependencies or its nested dependencies use built-in c / C ++ add-ons either their repo or the downloaded source code or the npm installation log itself. One way could be to look for the npm_modules folder for binding.gyp or .cc/.cpp files, and you should be able to find the criminal npm module.

+2
source

To find his addictions

 npm ls node-gyp 
+2
source

npm ls lists the installed dependencies in your project. npm ls node-gyp restrict node -gyp sub-tree.

npm-remote-ls lists all the dependencies of the remote package. You are manually browsing or using grep

I created findep , which is much faster than both (for this purpose). It can check your local project, an external npm package, or even a remote github project and has a --greedy option that stops as soon as it finds the specified dependency.

 # 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 
+1
source

node-gyp used to compile the built-in add-on modules for node. Have you looked at the documentation here , especially the windows information? Also, see this question for a way to meet Visual Studio requirements.

0
source

Source: https://habr.com/ru/post/1236790/


All Articles