CNode

新人请教,win7下安装的问题!

Aandrew发布于14 年前最后回复13 年前10 回复31128 浏览0 收藏
查看回复

回复 (10)

L
leohxj#1·13 年前

建议贴出package.json文件。

H
hebuliang#2·14 年前

nodejs的win版本自带npm,为什么还要再install一遍啊?想用最新版的直接update就行了

K
koalalalala#3·14 年前

同意楼上

L
letonlife#4·14 年前

现在已经可以直接安装windows版本了。我目前好像win,linux,mac的环境都有了。哈哈。

S
seanlv#5·14 年前

新版的nodejs中npm已经是标配了,三个平台下都是一样的。不需要单独安装了。

J
just1n#6·14 年前

不过新版的node安装包里虽然已经自带了npm,但用npm在安装某些模块的时候,有的命令还是不能用,比如有可能用到make命令,但其实windows下并没有这个命令,需要另外安装。

A
andrew#7·14 年前

假如我程序不安装formidable,会报错的啊:

Error: Cannot find module 'formidable'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (F:\workSpace\Node-http\requestHandlers.js:5:76)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Module.require (module.js:354:17)
    

安装的话会出现这个错误:

C:\Users\HL>npm install formidable
npm http GET https://registry.npmjs.org/formidable

npm ERR! Error: failed to fetch from registry: formidable
npm ERR!     at C:\Program Files\nodejs\node_modules\npm\lib\utils\npm-registry-
client\get.js:139:12
npm ERR!     at cb (C:\Program Files\nodejs\node_modules\npm\lib\utils\npm-regis
try-client\request.js:32:9)
npm ERR!     at Request._callback (C:\Program Files\nodejs\node_modules\npm\lib\
utils\npm-registry-client\request.js:137:18)
npm ERR!     at Request.callback (C:\Program Files\nodejs\node_modules\npm\node_
modules\request\main.js:109:22)
npm ERR!     at Request.<anonymous> (C:\Program Files\nodejs\node_modules\npm\no
de_modules\request\main.js:198:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\
npm\node_modules\request\main.js:195:10)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at CleartextStream.<anonymous> (http.js:1134:11)
npm ERR!     at CleartextStream.emit (events.js:67:17)
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR!
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "formidable"
npm ERR! cwd C:\Users\HL
npm ERR! node -v v0.6.10
npm ERR! npm -v 1.1.0-3
npm ERR! message failed to fetch from registry: formidable
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\HL\npm-debug.log
npm not ok

高手们指点一下!

F
fish#8·14 年前

npm库的问题,网路不通~,官方的那个源经常无法访问... 用这个http://registry.npmjs.vitecho.com/,切换一下源

npm config set registry “http://registry.npmjs.vitecho.com/”

然后再试试

A
andrew#9·14 年前
引用 fishnpm库的问题,网路不通 ,官方的那个源经常无法访问... 用这个http://registry.npmjs.vitecho.com/,切换一下源 npm config set registr...

还是不行啊 :

C:\Users\HL>npm config set registry "http://registry.npmjs.vitecho.com/"
npm WARN invalid config registry="��http://registry.npmjs.vitecho.com/��"
npm WARN invalid config Must be a full url with 'http://'
F
fish#10·14 年前

@andrew 提示http地址不对,手工输入以下,你复制的内容可能被编辑器改了...

npm config set registry "http://registry.npmjs.vitecho.com/"

参与回复
登录后即可参与回复。登录