简体   繁体   English

NPM安装强大在节点0.10中不起作用

[英]npm install formidable does not work in node 0.10

I am doing the tutorials in The Node Beginner Book and I cannot install formidable because of a version error. 我正在上The Node Beginner Book中的教程,由于版本错误,我无法安装formidable的软件。 Here's the error. 这是错误。 I seem to get this error with or without using sudo and @latest . 无论是否使用sudo@latest我似乎都会收到此错误。

npm install formidable@latest
npm http GET https://registry.npmjs.org/formidable
npm http 304 https://registry.npmjs.org/formidable
npm WARN engine formidable@1.0.13: wanted: {"node":"<0.9.0"} (current: {"node":"v0.10.0","npm":"1.2.14"})

The error means exactly what's stated, the module is expecting a Node version before 0.9.0 and your current version is 0.10.0. 该错误表示确切说明的内容,该模块期望Node版本为0.9.0之前,而您的当前版本为0.10.0。

wanted: {"node":"<0.9.0"}
current: {"node":"v0.10.0","npm":"1.2.14"}

An easy solution to this would be using an older version of Node, which you can easily get from the Node repository. 一个简单的解决方案是使用旧版本的Node,您可以从Node存储库中轻松获取。

You can also use n , which allows you to easily switch between or install multiple node binaries. 您还可以使用n ,这使您可以轻松地在它们之间切换或安装多个节点二进制文件。

npm install -g n
n 0.8.9
//installs node version 0.8.9

If you won't need the binary later, you can remove it easily. 如果以后不需要二进制文件,则可以轻松删除它。

n rm 0.8.9

转到github中readme.md,它将显示npm install命令以及git clone命令,如果npm安装失败,该命令应该可以使用。

git clone git://github.com/felixge/node-formidable.git formidable

try a fork of formidable that supposedly supported 0.10.x: 试试一个据说支持0.10.x的强大分支:

https://github.com/superjoe30/node-multiparty https://github.com/superjoe30/node-multiparty

I had the same exact problem with my node v0.10.25 after running the below code. 运行以下代码后,我的节点v0.10.25遇到了完全相同的问题。

> npm install formidable@latest

npm http GET https://registry.npmjs.org/formidable
npm http 304 https://registry.npmjs.org/formidable

I change the instruction to 我将指示更改为

> npm install formidable@1.0.2

It's now working perfectly fine. 现在工作正常。 I suppose the latest version is incompatible. 我想最新版本不兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM