无法通过NPM安装Mongoose

时间:2013-10-03 04:43:08

标签: node.js mongoose npm

我试图通过npm将mongoose下载到我的node.js项目中。

命令为npm install mongoose。但是,这会导致以下输出,并最终导致错误。 mongoose目录中唯一的东西是依赖项(在node_modules文件夹中)。任何其他包都可以使用,但是猫鼬一再失败。我尝试了npm install -g mongoosesudo npm install mongoose,但它们都没有。

任何想法可能出错?

节点版本0.10.20

npm版本1.3.11

$ npm install mongoose
npm WARN package.json mongo@0.1.0 No repository field.
npm http GET https://registry.npmjs.org/mongoose
npm http 304 https://registry.npmjs.org/mongoose
npm http GET https://registry.npmjs.org/ms/0.1.0
npm http GET https://registry.npmjs.org/sliced/0.0.5
npm http GET https://registry.npmjs.org/hooks/0.2.1
npm http GET https://registry.npmjs.org/muri/0.3.1
npm http GET https://registry.npmjs.org/mongodb/1.3.19
npm http GET https://registry.npmjs.org/regexp-clone/0.0.1
npm http GET https://registry.npmjs.org/mpath/0.1.1
npm http GET https://registry.npmjs.org/mpromise/0.2.1
npm http 304 https://registry.npmjs.org/ms/0.1.0
npm http 304 https://registry.npmjs.org/sliced/0.0.5
npm http 304 https://registry.npmjs.org/hooks/0.2.1
npm http 304 https://registry.npmjs.org/muri/0.3.1
npm http 304 https://registry.npmjs.org/mongodb/1.3.19
npm http 304 https://registry.npmjs.org/regexp-clone/0.0.1
npm http 304 https://registry.npmjs.org/mpath/0.1.1
npm http 304 https://registry.npmjs.org/mpromise/0.2.1
npm ERR! Error: ENOENT, chmod '/Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/mongodb/index.js'
npm ERR! If you need help, 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! System Darwin 11.4.2
npm ERR! command "/Users/khanh/.nvm/v0.10.20/bin/node" "/Users/khanh/.nvm/v0.10.20/bin/npm" "install" "mongoose"
npm ERR! cwd /Users/khanh/Code/bunnybots
npm ERR! node -v v0.10.20
npm ERR! npm -v 1.3.11
npm ERR! path /Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/mongodb/index.js
npm ERR! fstream_path /Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/mongodb/index.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /Users/khanh/.nvm/v0.10.20/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/hooks'
npm ERR! error rolling back  mongoose@3.6.20 { [Error: ENOTEMPTY, rmdir '/Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/hooks']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/hooks' }
npm ERR! Error: ENOENT, open '/Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/mpath/package.json'
npm ERR! If you need help, 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! System Darwin 11.4.2
npm ERR! command "/Users/khanh/.nvm/v0.10.20/bin/node" "/Users/khanh/.nvm/v0.10.20/bin/npm" "install" "mongoose"
npm ERR! cwd /Users/khanh/Code/bunnybots
npm ERR! node -v v0.10.20
npm ERR! npm -v 1.3.11
npm ERR! path /Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/mpath/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! Error: ENOENT, open '/Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/mpromise/README.md'
npm ERR! If you need help, 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! System Darwin 11.4.2
npm ERR! command "/Users/khanh/.nvm/v0.10.20/bin/node" "/Users/khanh/.nvm/v0.10.20/bin/npm" "install" "mongoose"
npm ERR! cwd /Users/khanh/Code/bunnybots
npm ERR! node -v v0.10.20
npm ERR! npm -v 1.3.11
npm ERR! path /Users/khanh/Code/bunnybots/node_modules/mongoose/node_modules/mpromise/README.md
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/khanh/Code/bunnybots/npm-debug.log
npm ERR! not ok code 0

3 个答案:

答案 0 :(得分:19)

使用npm cache clean

之后,正常安装,下载应该正确进行。

答案 1 :(得分:0)

我遇到了同样的问题。试试这个:

c1 = LineChart()
c1.title = "Title"
c1.y_axis.crossAx = 500
c1.x_axis = DateAxis(crossAx=100)
c1.x_axis.number_format = 'd-HH-MM-SS'
c1.x_axis.majorTimeUnit = "days"

c1.y_axis.title = "Voltage"
c1.x_axis.title = "Time"

data = Reference(ws2, min_col=2, min_row=1, max_col=2, max_row=sheet.max_row)
c1.add_data(data, titles_from_data=True)
dates = Reference(ws2, min_col=1, min_row=2, max_row=sheet.max_row)
c1.set_categories(dates)

这会将它安装在您的应用中,实际上是安装在您的npm install -s mongoose 上。它将作为依赖项提供,因此您可以轻松地package.json

否则尝试

require

这也应该起作用,从上面的输出中,我可以看到您没有尝试过。

答案 2 :(得分:-1)

如果停止节点服务器正在运行,那是我的问题