npm実行エラーError:EEXIST:file already exists解決方法
16758 ワード
node D:\Program Files
odejs , npm config set prefix "D:\Program Files
odejs
pm" npm 。 D:\Program Files
odejs npm(linux ) , npm Error: EEXIST: file already exists, mkdir 'D:\Program Files
odejs
pm' 。 2 。
1、 npm , npm D:\Program Files
odejs npm , npm config set prefix 。
2、 %appdata%/../.. .npmrc , npm userconfig , :prefix=D:\Program Files
odejs
pm, prefix 。
npm config set prefix npm config set cache npm cache 。
npm install express -g express ,-g npm 。 -g 。
npm config ls -l :
C:\Users\soft>npm config ls -l
; cli configs
long = true
user-agent = "npm/3.10.9 node/v7.2.0 win32 x64"
; userconfig C:\Users\soft\.npmrc
prefix = "D:\\Program Files\
odejs\
ode_global"
; builtin config undefined
; prefix = "C:\\Users\\soft\\AppData\\Roaming\
pm" (overridden)
; default values
access = null
also = null
always-auth = false
bin-links = true
browser = null
ca = null
cache = "C:\\Users\\soft\\AppData\\Roaming\
pm-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 = "D:\\Program Files\
odejs\
ode_global\\etc\
pmrc"
globalignorefile = "D:\\Program Files\
odejs\
ode_global\\etc\
pmignore"
group = 0
heading = "npm"
https-proxy = null
if-present = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\\Users\\soft\\.npm-init.js"
init-version = "1.0.0"
json = false
key = null
legacy-bundling = false
link = false
local-address = undefined
loglevel = "warn"
; long = false (overridden)
maxsockets = 50
message = "%s"
node-version = "7.2.0"
npat = false
onload-script = null
only = null
optional = true
parseable = false
; prefix = "D:\\Program Files\
odejs" (overridden)
production = false
progress = true
proprietary-attribs = true
proxy = null
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = false
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
scope = ""
searchexclude = null
searchopts = ""
searchsort = "name"
shell = "C:\\WINDOWS\\system32\\cmd.exe"
shrinkwrap = true
sign-git-tag = false
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
tmp = "C:\\Users\\soft\\AppData\\Local\\Temp"
umask = 0
unicode = false
unsafe-perm = true
usage = false
user = 0
; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overridden)
userconfig = "C:\\Users\\soft\\.npmrc"
version = false
versions = false
viewer = "browser"
npm :npm config set registry http://registry.npmjs.vitecho.com
npm :npm install -g express --registry=https://registry.npm.taobao.org
NODE_PATH, node_modules :D:\Program Files
odejs
ode_global
ode_modules。 , require('express') :
> require('express')
Error: Cannot find module 'express'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at repl:1:1
at realRunInThisContextScript (vm.js:22:35)
at sigintHandlersWrap (vm.js:98:12)
at ContextifyScript.Script.runInThisContext (vm.js:24:12)
at REPLServer.defaultEval (repl.js:313:29)
at bound (domain.js:280:14)
npm 6 , 。
1、 。 --proxy http://server:port proxy http://server:port。
2、 。 npm_config_ npm 。 proxy npm_config_proxy=http://server:port。
3、 。 npm config get userconfig 。 mac $HOME/.npmrc。
4、 。 npm config get globalconfig 。mac /usr/local/etc/npmrc。
5、 。 npm npmrc 。
6、 。 npm , 5 , npm 。
npm config get userconfig userconfig , npm config edit userconfig 。 npm config get globalconfig globalconfig , npm config --global edit globalconfig :
C:\Users\soft>npm config edit
C:\Users\soft>npm config get userconfig
C:\Users\soft\.npmrc
C:\Users\soft>npm config get globalconfig
D:\Program Files
odejs
ode_global\etc
pmrc
C:\Users\soft>npm config --global edit
C:\Users\soft>
npm install xxx node_module 。
npm install xxx -g
npm ls
npm ls -g
npm uninstall xxx (-g)
npm cache clean
node (windows ), C:\Users\ .npmrc , npm :
prefix = D:\Program Files
odejs
ode_global
cache = D:\Program Files
odejs
ode_global
D:\Program Files
odejs
ode_global
ode_modules path , 。