2016-05-03 5 views
1

ノード5/6でnpm 3.8.6で奇妙な動作またはnpm pruneが検出されました。使用済みのパッケージが削除され、ビルドが壊れています。npm pruneは使用済みのパッケージを削除し、ビルドが壊れたままにします。代替手段は何ですか?

┌(~/Sites/test_client)─(16 files, 280b) 
└> npm prune 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild tildi[email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 
unbuild [email protected] 

とビルドが壊れている:

┌(~/Sites/test_client)─(16 files, 280b) 
└> nvm use v5 
Now using node v5.11.0 (npm v3.8.6) 

┌(~/Sites/test_client)─(16 files, 280b) 
└> npm cache clean 

┌(~/Sites/test_client)─(16 files, 280b) 
└> rm -rf node_modules/ 

┌(~/Sites/test_client)─(15 files, 280b) 
└> npm i 

> [email protected] install /Users/metalim/Sites/test_client/node_modules/fsevents 
> node-pre-gyp install --fallback-to-build 

[fsevents] Success: "/Users/metalim/Sites/test_client/node_modules/fsevents/lib/binding/Release/node-v47-darwin-x64/fse.node" is installed via remote 
[email protected] /Users/metalim/Sites/test_client 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] (git://github.com/gulpjs/gulp.git#b4d89c391b40cd29e8526e0391981eef67cfccab) 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] (git://github.com/goldfire/howler.js.git#db831e03cf696d1ca5cfdd8f87d66e66da2c5029) 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
└── [email protected] 

そして直後:新鮮なの

"dependencies": { 
    "browser-sync": "^2.11.1", 
    "browserify": "^13.0.0", 
    "coffee-script": "^1.9.3", 
    "coffeeify": "^2.0.1", 
    "cson": "^3.0.2", 
    "fastclick": "^1.0.6", 
    "gulp": "github:gulpjs/gulp#4.0", 
    "gulp-git": "^1.7.0", 
    "gulp-uglify": "^1.2.0", 
    "gulp-util": "^3.0.6", 
    "howler": "github:goldfire/howler.js#2.0", 
    "minimatch": "^3.0.0", 
    "nouislider": "^8.2.1", 
    "parcelify": "^2.1.0", 
    "q": "^1.4.1", 
    "vinyl-buffer": "^1.0.0", 
    "vinyl-source-stream": "^1.1.0", 
    "watchify": "^3.7.0" 
    }, 

結果はインストール:

はここdep.listです。どうしましたか?それはnpmバグですか?

少しのテストの結果、npm pruneはv5より前のノードバージョン(npm v3)でのみ動作することがわかりました:v4.4.3(npm v2.15.1)以下で動作します。基本的に、npm v3で導入されたフラット依存関係リストでは機能しません。

未使用のモジュールをクリーンアップするためのフラットな依存関係リストの代わりにnpm pruneとは何ですか?

答えて

2

自分自身で回答しています。

npm configに問題があり、予期せぬ影響がnpm pruneの--depthオプションにありました。 npm lsコマンドの出力をクリーンアップするためにnpm config set depth 0を実行すると、npm pruneがnpm v3 +で壊れてしまいます。それは--depthオプションを考慮に入れているようで、フラットな依存関係リストでは悲惨に失敗します。だから、

、問題に対する修正されました:だけで正常に動作npm pruneその後 npm config delete depth

+0

私はうまくいけば、これを覚えています。 – andersoyvind

関連する問題