[RESOLVED] Error: using jade with react in jsx (react-jade)


#1

I’m trying out react but I’d like to render in jade and I’m having problems using the official npm react-jade package.

// package.json
{
  "externalify": "0.1.0",
  "react-jade":"2.4.0"
}

// app.browserify.js
jade = require('react-jade');

//app.browserify.options.json
//shouldn't matter as this is a npm package, not react component
{
  "transforms": {
    "externalify": {
      "global": true,
      "external": {
        "react": "React.require"
      }
    }
  }
}

Installed react-jade globally, but getting this error on meteor run

events.js:72                                                                                                       
        throw er; // Unhandled 'error' event                                                                       
              ^                                                                                                    
Error: Cannot find module './compile-client.js' from 'c:\code\odo2\packages\npm-container\.npm\package'            
  at C:\Users\mordrax\AppData\Local\.meteor\packages\cosmos_browserify\0.4.0\plugin.CosmosBrowserify.os\npm\CosmosBrowserify\node_modules\browserify\node_modules\resolve\lib\async.js:55:21                                          
  at load (C:\Users\mordrax\AppData\Local\.meteor\packages\cosmos_browserify\0.4.0\plugin.CosmosBrowserify.os\npm\C
osmosBrowserify\node_modules\browserify\node_modules\resolve\lib\async.js:69:43)                                   
  at onex (C:\Users\mordrax\AppData\Local\.meteor\packages\cosmos_browserify\0.4.0\plugin.CosmosBrowserify.os\npm\C
osmosBrowserify\node_modules\browserify\node_modules\resolve\lib\async.js:92:31)                                   
  at C:\Users\mordrax\AppData\Local\.meteor\packages\cosmos_browserify\0.4.0\plugin.CosmosBrowserify.os\npm\CosmosBrowserify\node_modules\browserify\node_modules\resolve\lib\async.js:22:47 at Object.oncomplete (fs.js:108:15)                                                                              

EDIT:
I should also mention that the afore missing file compile-client.js can be found in the following locations
C:\code\odo2\packages\npm-container\.npm\package\node_modules\react-jade\lib\compile-client.js
and
C:\code\odo2\node_modules\react-jade\lib\compile-client.js

but it’s looking for it in c:\code\odo2\packages\npm-container\.npm\package


[1.3] react-jade module
#2

Upgraded to cosmos:browserify 0.5.0 - made no difference
Reinstalled npm/meteor packages - nothing
Deleted packages and npm_modules folders and had meteor regenerate them, worked!


#4

Same error here with cosmos:browserify 0.9.2.
Meteor reset did not help.
Let’s try your solution!


#5

Yep, your solution worked! :smile: