【发布时间】:2015-08-04 06:40:24
【问题描述】:
我在使用 cosmos:browserify 在 Meteor 中安装 React-masonry-component 时遇到问题。错误消息表明找不到组件的依赖项 masonry 的兼容版本(我相信在 npm 中)。相同的 react 包似乎可以在使用 Webpack 的常规节点项目中工作,这就是为什么我认为这个问题是 Meteor 特有的。
这是我的 packages.json 文件。
{
"externalify": "0.1.0",
"react-router": "0.13.3",
"react-pixi": "0.6.1",
"radium": "0.13.4",
"griddle-react": "0.2.13",
"react-masonry-component": "1.0.1"
}
app.browserify.js
ReactRouter = require("react-router");
ReactPIXI = require("react-pixi");
Radium = require("radium");
Griddle = require("griddle-react");
Masonry = require("react-masonry-component");
构建过程中的错误消息
=> Modified -- restarting.
npm-container: updating npm dependencies -- externalify, react-router,
react-pixi, radium, griddle-react, masonry-layout, imagesloaded,
react-masonry-component...
npm ERR! Windows_NT 6.2.9200
npm ERR! argv
"C:\\Users\\Nick\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.1.4\\mt- os.windows.x86_32\\dev_bundle\\bin\\\\node.exe"
"C:\\Users\\Nick\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.1.4\\mt-os.windows.x86_32\\dev_bundle\\bin\\node_modules\\npm\\bin\\npm-cli.js"
"install" "react-masonry-component@1.0.1"
npm ERR! node v0.10.36
npm ERR! npm v2.7.3
npm ERR! code ETARGET
npm ERR! notarget No compatible version found:
masonry@'git+ssh://git@github.com/eiriklv/masonry.git'
**npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.0.1","0.0.2"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are
requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of
'react-masonry-component'
npm ERR! notarget
=> Errors prevented startup:
While building package npm-container:
error: couldn't install npm package
=> Your application has errors. Waiting for file change.
【问题讨论】:
-
React-Masonry 组件作者 Eirik 的评论:“尝试从 github 而不仅仅是 npm 安装依赖项时似乎存在问题,因为它正在尝试安装此包:npmjs.com/package/masonry 这是在 0.0.1 和 0.0.2 版本中可用,当它应该安装 github.com/eiriklv/masonry。从这个链接:meteorhacks.com/complete-npm-integration-for-meteor 似乎你只能指定一个编号版本,这让我认为 npm 支持在某些方面是有限的排序。”