2017-06-07 7 views
-1

npm installコマンドは、node_modules内のすべてのパッケージを削除しますが、package.jsonでは削除しません。なぜ "npm install"はnode_modules内のすべてのパッケージを削除するのですか?

NPMのconfig(npm confg ls -lは)

long = true 
metrics-registry = "https://registry.npmjs.org/" 
scope = "" 
user-agent = "npm/5.0.3 node/v7.4.0 win32 x64" 

; globalconfig C:\Users\Nicola\AppData\Roaming\npm\etc\npmrc 
production = true 

; builtin config undefined 
prefix = "C:\\Users\\Nicola\\AppData\\Roaming\\npm" 

; default values 
access = null 
allow-same-version = false 
also = null 
always-auth = false 
auth-type = "legacy" 
bin-links = true 
browser = null 
ca = null 
cache = "C:\\Users\\Nicola\\AppData\\Roaming\\npm-cache" 
cache-lock-retries = 10 
cache-lock-stale = 60000 
cache-lock-wait = 10000 
cache-max = null 
cache-min = 10 
cafile = undefined 
cert = null 
color = true 
depth = null 
description = true 
dev = false 
dry-run = false 
editor = "notepad.exe" 
engine-strict = false 
fetch-retries = 2 
fetch-retry-factor = 10 
fetch-retry-maxtimeout = 60000 
fetch-retry-mintimeout = 10000 
force = false 
git = "git" 
git-tag-version = true 
global = false 
global-style = false 
globalconfig = "C:\\Users\\Nicola\\AppData\\Roaming\\npm\\etc\\npmrc" 
globalignorefile = "C:\\Users\\Nicola\\AppData\\Roaming\\npm\\etc\\npmignore" 
group = 0 
ham-it-up = false 
heading = "npm" 
https-proxy = null 
if-present = false 
ignore-prepublish = false 
ignore-scripts = false 
init-author-email = "" 
init-author-name = "" 
init-author-url = "" 
init-license = "ISC" 
init-module = "C:\\Users\\Nicola\\.npm-init.js" 
init-version = "1.0.0" 
json = false 
key = null 
legacy-bundling = false 
link = false 
local-address = undefined 
loglevel = "notice" 
logs-max = 10 
; long = false (overridden) 
maxsockets = 50 
message = "%s" 
; metrics-registry = null (overridden) 
node-version = "7.4.0" 
offline = false 
onload-script = null 
only = null 
optional = true 
package-lock = true 
parseable = false 
prefer-offline = false 
prefer-online = false 
; prefix = "C:\\Program Files\\nodejs" (overridden) 
production = true 
progress = true 
proprietary-attribs = true 
proxy = null 
rebuild-bundle = true 
registry = "https://registry.npmjs.org/" 
rollback = true 
save = true 
save-bundle = false 
save-dev = false 
save-exact = false 
save-optional = false 
save-prefix = "^" 
save-prod = false 
scope = "" 
scripts-prepend-node-path = "warn-only" 
searchexclude = null 
searchlimit = 20 
searchopts = "" 
searchstaleness = 900 
send-metrics = false 
shell = "C:\\WINDOWS\\system32\\cmd.exe" 
shrinkwrap = true 
sign-git-tag = false 
sso-poll-frequency = 500 
sso-type = "oauth" 
strict-ssl = true 
tag = "latest" 
tag-version-prefix = "v" 
timing = false 

umask = 0 
unicode = false 
unsafe-perm = true 
usage = false 
user = 0 

version = false 
versions = false 
viewer = "browser" 

その他の奇妙なことである:npm updateと 'NPM --only = devのインストール' 良い動作しますが、PhpStorm(ファイルにこのcommadを実行した後 - > [設定] - > Laguanges and Framework - > Node.js ana NPM)私はdevDependeciesだけを列挙しています。

package.json

{ 
    "name": "XYZ", 
    "version": "1.0.0", 
    "description": "", 
    "main": "index.html", 
    "scripts": { 
    "dev": "webpack", 
    "devWatch": "webpack --watch", 
    "build": "webpack -p" 
    }, 
    "author": "X, Y, Z", 
    "license": "ISC", 
    "devDependencies": { 
    "assets-webpack-plugin": "^3.4.0", 
    "babel-core": "^6.11.4", 
    "babel-loader": "^6.2.4", 
    "babel-plugin-syntax-dynamic-import": "^6.18.0", 
    "babel-preset-es2015": "^6.9.0", 
    "babel-preset-react": "^6.11.1", 
    "babel-preset-stage-0": "^6.24.1", 
    "babel-runtime": "^6.11.6", 
    "clean-webpack-plugin": "^0.1.10", 
    "copy-webpack-plugin": "^3.0.1", 
    "create-react-class": "^15.5.3", 
    "css-loader": "^0.28.4", 
    "extract-text-webpack-plugin": "^2.1.0", 
    "file-loader": "^0.9.0", 
    "html-webpack-plugin": "^2.22.0", 
    "imports-loader": "^0.6.5", 
    "style-loader": "^0.18.2", 
    "uglify-loader": "^1.3.0", 
    "url-loader": "^0.5.8", 
    "webpack": "^2.6.1", 
    "webpack-dev-server": "^1.14.1" 
    }, 
    "dependencies": { 
    "babel-plugin-transform-runtime": "^6.23.0", 
    "bbcode-to-react": "^0.2.6", 
    "dropzone": "^4.3.0", 
    "flux": "^3.1.2", 
    "history": "^3.3.0", 
    "jquery": "^2.2.4", 
    "jquery-file-download": "^1.4.6", 
    "jquery.nicescroll": "^3.6.8", 
    "js-cookie": "^2.1.4", 
    "lg-autoplay": "^1.0.4", 
    "lg-fullscreen": "^1.0.1", 
    "lg-hash": "^1.0.2", 
    "lg-pager": "^1.0.2", 
    "lg-share": "^1.0.2", 
    "lg-thumbnail": "^1.0.3", 
    "lg-video": "^1.0.2", 
    "lg-zoom": "^1.0.4", 
    "lightgallery": "^1.4.0", 
    "linkifyjs": "^2.1.4", 
    "react": "^15.5.4", 
    "react-dom": "^15.5.4", 
    "react-dropzone-component": "^1.4.1", 
    "react-intl": "^2.3.0", 
    "react-router": "^3.0.5", 
    "validator": "^7.0.0" 
    } 
} 

答えて

0

PhpStormはのNode.jsとNPM設定ページにすべての依存関係を示しています。実際にpackage.jsonに「依存関係」がありますか?

+0

はい、私は依存関係があります。元の投稿を編集してpackage.jsonを追加しました – Webman

+0

この問題を解決できましたか?私もこれを持っていた。 – shawnl

+0

@shawnl私のコンピュータをフォーマットしました – Webman

関連する問題