[英]How to find node-gyp dependency (..or any dependency) in npm project
我正經歷着無法想象的挫敗,試圖使一個項目總是運行在node-gyp上而無法運行(即通過調用'npm install' )。 我在Windows上,因此我需要安裝python和類似Visual Studio的工具。
長話短說...我不想像Visual Studio那樣依賴一堆令人討厭的s ***,所以我想看看這個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"
}
我可以通過以下步驟查看每個軟件包的依賴關系樹:
但是,如果我經歷了這些依賴關系中的每一個,我就無法在任何地方看到node-gyp依賴關系。
關於依賴項,我是否不了解? 什么使用node-gyp? 又為什么呢
查找其依賴項
npm ls node-gyp
npm ls
列出了項目中已安裝的依賴項。 npm ls node-gyp
將限制node-gyp的子樹。
npm-remote-ls
列出了遠程軟件包的所有依賴項。 您手動檢查或使用grep
我創建了findep
,它比兩者都快很多(為此目的)。 它可以檢查您的本地項目,一個外部npm包,甚至是一個遠程github項目,並且具有--greedy
選項,該選項一旦找到指定的依賴項便會停止。
# 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.