2015-11-25 133 views
5

我經歷難以想象的挫折試圖讓一個項目運行(即通過調用「故宮安裝」)總是形影不離,node-gyp。我在Windows上,所以我需要安裝Python和類似Visual Studio的東西。如何找到在NPM項目節點GYP依賴(..或任何依賴性)

長話短說......我不想依賴於像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/#/

但是如果我去通過這些相關的每一個我看不到的節點GYP依賴任何地方任何這些。

有什麼我不明白依賴?什麼使用node-gyp?爲什麼?

回答

0

node-gyp用於編譯節點的本地附加模塊。你有沒有看過文檔here,特別是Windows的信息?另外,看看this question周邊的Visual Studio的要求

2

節點GYP需要natice℃的方式/ C++作爲DOC here

的依賴是建立每個目標平臺上提到的附件添加。對於Windows平臺它需要在他們的installation notes here

node-gyp提到本身不package.json(可能是因爲它需要全球性的安裝),因此,您必須手動查看是否有任何依賴性或者其嵌套依賴使用本地提到的Visual Studio c/C++可以通過它們的repo或下載的源代碼或npm安裝日誌本身進​​行添加。一種方法可能是在npm_modules文件夾中搜索文件binding.gyp.cc/.cpp文件,並且您應該能夠找到罪魁禍首npm模塊。

1

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 
2

要找到它的依賴性

npm ls node-gyp 
+0

很簡單的解決方案,謝謝! –

相關問題