【问题标题】:How to find npm configuration error or reset npm from scratch?如何查找 npm 配置错误或从头开始重置 npm?
【发布时间】:2016-03-29 01:36:14
【问题描述】:

我创建了一个测试项目文件夹,其中包含一个非常简单的 package.json:

{
  "name": "my-project",
  "version": "1.0.0",
  "devDependencies": {
    "babel-cli": "^6.0.0"
  }
}

当在项目文件夹中运行npm install 时,它会安装很多包。所有这些从何而来?某处的 npm 配置中是否有错误?

这现在在我的 node_modules 文件夹中:

amdefine
ansi-green
ansi-regex
ansi-styles
ansi-wrap
anymatch
arr-diff
arr-flatten
array-uniq
array-unique
arrify
asn1
assert-plus
async
async-each
aws-sign2
babel-cli
babel-code-frame
babel-core
babel-generator
babel-helpers
babel-messages
babel-polyfill
babel-regenerator-runtime
babel-register
babel-runtime
babel-template
babel-traverse
babel-types
babylon
balanced-match
bin-version
bin-version-check
binary-extensions
bl
boom
brace-expansion
braces
builtin-modules
camelcase
camelcase-keys
caseless
chalk
chokidar
combined-stream
commander
concat-map
convert-source-map
core-js
core-util-is
cryptiles
dashdash
debug
delayed-stream
detect-indent
ecc-jsbn
error-ex
escape-string-regexp
esutils
expand-brackets
expand-range
extend
extglob
extsprintf
filename-regex
fill-range
find-up
find-versions
for-in
for-own
forever-agent
form-data
fs-readdir-recursive
fsevents
generate-function
generate-object-property
get-stdin
glob
glob-base
glob-parent
globals
graceful-fs
graceful-readlink
har-validator
has-ansi
hawk
hoek
home-or-tmp
hosted-git-info
http-signature
indent-string
inflight
inherits
invariant
is-arrayish
is-binary-path
is-buffer
is-builtin-module
is-dotfile
is-equal-shallow
is-extendable
is-extglob
is-finite
is-glob
is-integer
is-my-json-valid
is-number
is-primitive
is-property
is-typedarray
is-utf8
isarray
isobject
isstream
jodid25519
js-tokens
jsbn
json-schema
json-stringify-safe
json5
jsonpointer
jsprim
kind-of
left-pad
line-numbers
load-json-file
lodash
log-symbols
loose-envify
loud-rejection
map-obj
meow
micromatch
mime-db
mime-types
minimatch
minimist
mkdirp
ms
nan
node-uuid
normalize-package-data
normalize-path
number-is-nan
oauth-sign
object-assign
object.omit
once
os-tmpdir
output-file-sync
parse-glob
parse-json
path-exists
path-is-absolute
path-type
pify
pinkie
pinkie-promise
preserve
private
process-nextick-args
qs
randomatic
read-pkg
read-pkg-up
readable-stream
readdirp
redent
regex-cache
repeat-element
repeat-string
repeating
request
semver
semver-regex
semver-truncate
shebang-regex
signal-exit
slash
sntp
source-map
source-map-support
spdx-correct
spdx-exceptions
spdx-expression-parse
spdx-license-ids
sshpk
string_decoder
stringstream
strip-ansi
strip-bom
strip-indent
success-symbol
supports-color
to-fast-properties
tough-cookie
trim-newlines
trim-right
tunnel-agent
tweetnacl
user-home
util-deprecate
v8flags
validate-npm-package-license
verror
wrappy
xtend

如果我以某种方式破坏了我的 npm 配置,那么重置它的最佳方法是什么?我可以卸载 node/npm 和它的所有东西吗?

【问题讨论】:

  • 您是否在另一个项目中使用过这些模块,或者它们只是看似随机出现的?
  • 它们中的大多数看起来并不熟悉,但可能是我很久以前在教程项目中下载/安装了它们。

标签: node.js npm package.json


【解决方案1】:

你可能做了命令

npm 安装

在您创建其他文件时位于同一文件夹中。

仅 babel-cli 就有 20 个依赖项: v8flags、源映射、斜杠、请求、路径是绝对的、路径存在、输出文件同步、日志符号、lodash、glob、fs-readdir-recursive、转换源映射、指挥官、chokidar、粉笔,bin-version-check,babel-runtime,babel-polyfill,babel-register,babel-core

【讨论】:

  • 谢谢,我没有意识到这一点。但是即使所有这些包都属于 babel,那么仍然...... babel CLI 命令不起作用......
  • @Kokodoko babel-cli 是一个cli 程序,这意味着它应该在路径中才能运行。指定手动路径,或全局安装npm install -g babel-cli
  • 如果你在本地安装一个包,没有 -g 开关你可以访问它node ./node_modules/babel-cli/bin/babel.js
  • 啊,我没有意识到这一点! Babel 页面特别提到不要全局安装它,因为每个项目可能需要不同的 Babel 版本。
猜你喜欢
  • 2021-05-20
  • 2018-03-09
  • 1970-01-01
  • 2018-07-09
  • 1970-01-01
  • 2020-04-15
  • 2014-12-25
  • 2020-06-21
  • 2018-12-31
相关资源
最近更新 更多