elidoran / cosmos-browserify

Browserify npm modules for client side in Meteor packages
MIT License
78 stars 12 forks source link

can't start meteor for module '_stream_0.js' not found #14

Closed chenkaiC4 closed 9 years ago

chenkaiC4 commented 9 years ago

when i set up my project, meteor just throw following error. when i remove cosmos:browserify, error dispear and meteor set up sucessfully. However, the example can be set up, but when i add cosmos:browserify to my project, it dosen't work.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Cannot find module '/Users/chenkai/meteor-project/cms/packages/npm-container/.npm/package/_stream_0.js' from '/Users/chenkai/meteor-project/cms/packages/npm-container/.npm/package'
  at /Users/chenkai/.meteor/packages/cosmos_browserify/.0.4.0.sl31fx++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/resolve/lib/async.js:55:21
  at load (/Users/chenkai/.meteor/packages/cosmos_browserify/.0.4.0.sl31fx++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
  at onex (/Users/chenkai/.meteor/packages/cosmos_browserify/.0.4.0.sl31fx++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
  at /Users/chenkai/.meteor/packages/cosmos_browserify/.0.4.0.sl31fx++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
  at Object.oncomplete (fs.js:108:15)

this is my packages installed, i doubt if there is a conflict in packages.

meteor-platform
underscore
twbs:bootstrap
coffeescript
iron:router
sacha:spin
ian:accounts-ui-bootstrap-3
accounts-password
audit-argument-checks
reactive-var
http
jaywon:meteor-node-uuid
froala:editor-reactive
jparker:crypto-md5
agnito:autogrow
jeremy:selectize
monbro:iron-router-breadcrumb
momentjs:moment
vazco:universe-html-purifier
mizzao:bootboxjs
react
react-template-helper
semantic:ui-checkbox
u2622:persistent-session
cosmos:browserify
meteorhacks:npm
npm-container

need help, thanks!

elidoran commented 9 years ago

It's not the packages causing the issue. It's the npm modules being browserified.

The important parts of the error are:

  1. Cannot find module
  2. '/Users/chenkai/meteor-project/cms/packages/npm-container/.npm/package/_stream_0.js'

The first means browserify wasn't able to find something and errored out. The second is what it was looking for.

What is in the packages.json file?

What is in the app.browserify.js file?

Also, a google search for _stream_0.js has results relating to browserify, so this may be an issue others are encountering while using browserify.

It would be helpful if I caught the browserify error and printed a more helpful message.

elidoran commented 9 years ago

I fixed the broken error handling (I broke it in 0.4.0). Version 0.5.0 shows the error like this:

=> Errors prevented startup:                  

   While building the application:
   client/app.browserify.js: Cannot find module 'some-module' from '/absolute/path/to/app/packages/npm-container/.npm/package'

This doesn't explain why, in your issue, it's trying to resolve that long path as a module name. If you share what you're putting in packages.json and browserify.js files I can check it out.

bpartridge commented 9 years ago

Just saw the same problem - it seems to occur when packages.json has packages, but the .browserify.js file is empty. Presumably there's some logic somewhere where if nothing is browserified, it tries to load a module with this long filename? It would seem that this is a bug, though not a high-priority one if we just add a reminder in the Readme that the .browserify.js files shouldn't be blank.

elidoran commented 9 years ago

Providing an empty readable stream to browserify causes an error when its bundle() function is called.

I made a patch release, 0.5.1, which adds a newline character to the stream when CompileStep provides an empty buffer.