npm install
命令删除node_modules中的所有包,但不删除package.json中的所有包。
npm的配置(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 install --only = dev'工作得很好,但在PhpStorm执行此commad后(文件 - >设置 - > Laguanges和框架 - > Node.js和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 :(得分:0)
PhpStorm列出 Node.js和NPM 设置页面中的所有依赖项。你真的有"依赖"在package.json?