Jason O.
Jason O.

Reputation: 3300

React-masonry-component in Meteor

I'm having trouble installing React-masonry-component in Meteor using cosmos:browserify. The error message indicates no compatible version of the component's dependency, masonry, can be found (in npm, I believe). The same react package seems to work in a regular node project using Webpack, which is why I believe this issue is Meteor specific.

Here is my packages.json file.

{
  "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");

Error message during build process

=> 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" "[email protected]"
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://[email protected]/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.

Upvotes: 0

Views: 868

Answers (1)

Jason O.
Jason O.

Reputation: 3300

Since Meteorhacks:npm requires a specific version/commit of npm or github module, the Meteor build process failed to include this React-Masonry-Component whose package.json defines dependency without referring to a specific commit. For example,

"dependency": {"masonry" = "eirik/masonry"}

To avoid this issue, I forked Eirik's npm module and published a version that defines all of it's dependency with either a specific npm version or github commit. For example,

"dependency": {"masonry" = "https://github.com/eirik/masonry/archive/dd74b7c6fe58e9f5de56d2ab442ac4b2d0fa5dd1.tar.gz"}

See https://github.com/meteorhacks/npm for more detail on this requirement.

The code now works with the following settings:

packages.json

"react-masonry-component-4meteorhacks-npm": "0.0.13"

app.browserify.js

Masonry = require("react-masonry-component-4meteorhacks-npm")(React);

Upvotes: 2

Related Questions