2016-04-06 87 views
5

我正在嘗試從我的一個項目中引用logary-js來自github的npm包,丟失文件

我有這個packages.json文件:

... 
"dependencies": { 
    "logary": "logary/logary-js#master", 
    ... 
} 
... 

然而,試圖拉下包時,它失敗,此錯誤:

✗ npm install 

> [email protected] preinstall /Users/h/dev/proj/node_modules/.staging/logary-6603d70a 
> npm run build 


> [email protected] build /Users/h/dev/proj/node_modules/.staging/logary-6603d70a 
> NODE_ENV=production webpack --progress --color --display-error-details --display-reasons --optimize-minimize 

webpack 1.12.14 
Usage: https://webpack.github.io/docs/cli.html 

Options: 
    --help, -h, -? 
    --config 
    --context 
    --entry 
    --module-bind 
    --module-bind-post 
    --module-bind-pre 
    --output-path 
    --output-file 
    --output-chunk-file 
    --output-named-chunk-file 
    --output-source-map-file 
    --output-public-path 
    --output-jsonp-function 
    --output-pathinfo 
    --output-library 
    --output-library-target 
    --records-input-path 
    --records-output-path 
    --records-path 
    --define 
    --target 
    --cache                       [default: true] 
    --watch, -w 
    --watch which closes when stdin ends 
    --watch-aggregate-timeout 
    --watch-poll 
    --hot 
    --debug 
    --devtool 
    --progress 
    --resolve-alias 
    --resolve-loader-alias 
    --optimize-max-chunks 
    --optimize-min-chunk-size 
    --optimize-minimize 
    --optimize-occurence-order 
    --optimize-dedupe 
    --prefetch 
    --provide 
    --labeled-modules 
    --plugin 
    --bail 
    --profile 
    -d         shortcut for --debug --devtool sourcemap --output-pathinfo 
    -p         shortcut for --optimize-minimize 
    --json, -j 
    --colors, -c 
    --sort-modules-by 
    --sort-chunks-by 
    --sort-assets-by 
    --hide-modules 
    --display-exclude 
    --display-modules 
    --display-chunks 
    --display-error-details 
    --display-origins 
    --display-cached 
    --display-cached-assets 
    --display-reasons, --verbose, -v 

Output filename not configured. 

npm ERR! Darwin 14.5.0 
npm ERR! argv "/Users/h/.nvm/versions/node/v5.6.0/bin/node" "/Users/h/.nvm/versions/node/v5.6.0/bin/npm" "run" "build" 
npm ERR! node v5.6.0 
npm ERR! npm v3.6.0 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] build: `NODE_ENV=production webpack --progress --color --display-error-details --display-reasons --optimize-minimize` 
npm ERR! Exit status 255 
npm ERR! 
npm ERR! Failed at the [email protected] build script 'NODE_ENV=production webpack --progress --color --display-error-details --display-reasons --optimize-minimize'. 

這是你得到,如果有一個錯誤目錄中沒有webpack.config.js文件。這讓我相信,npm只是拉下幾個文件。 NPM-說的debug.log:

89 verbose tar unpack /Users/h/.npm/logary/1.0.0/package.tgz 
90 verbose tar unpacking to /Users/h/dev/proj/node_modules/.staging/logary-6603d70a 
91 silly gentlyRm /Users/h/dev/proj/node_modules/.staging/logary-6603d70a is being purged 
92 verbose gentlyRm don't care about contents; nuking /Users/h/dev/proj/node_modules/.staging/logary 
-6603d70a 
93 silly gunzTarPerm modes [ '770', '660' ] 
94 silly gunzTarPerm extractEntry package.json 
95 silly gunzTarPerm extractEntry README.md 
96 silly gunzTarPerm extractEntry LICENSE 
97 silly gentlyRm /Users/h/dev/proj/node_modules/.staging/logary-6603d70a/node_modules is being purg 
ed 
98 verbose gentlyRm don't care about contents; nuking /Users/h/dev/proj/node_modules/.staging/logary 
-6603d70a/node_modules 
99 silly doParallel preinstall 1 
100 silly preinstall [email protected] /Users/h/dev/proj/node_modules/.staging/logary-6603d70a 
101 info lifecycle [email protected]~preinstall: [email protected] 

而且,在這個例子中https://github.com/logary/logary-js/tree/master/examples/webpack它引用logary就好了,雖然通過文件系統,而不是github上。

所以問題就變成了;我如何從github引用logary?或者我應該在package.json文件中更改它以使其正常工作?

+0

你有沒有理由不在npm中使用該版本? – Andy

+1

是的,這是我自己的圖書館,我想在自己的軟件中保持最新的優勢。 – Henrik

回答

0

您可以使用語法npm install --save https://github.com/{USER}/{REPO}/tarball/{BRANCH}從GitHub安裝節點包。你也可以檢查這個answer,它有很好的提示。