eploko / broccoli-watchify

Watchify plugin for Broccoli.
MIT License
6 stars 10 forks source link

Error: Cannot find module 'babelify'… (it can't find any installed module) #7

Closed Oli4242 closed 5 years ago

Oli4242 commented 7 years ago

I'm not sure if it is a bug or if I'm missing something but this:

let javascript = new Watchify('src', {
  browserify: {
    entries: ['main.js'],
    debug: true
  },
  outputFile: 'game.js',
  init(b) {
    b.transform('babelify', {
      presets: ['es2015', 'es2016'],
    })
  }
})

Causes the following error:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: Cannot find module 'babelify' from '/tmp/broccoli-513366CB9iSXvlnzg/cache-2-watchify'
    at /tmp/phaser-test/node_modules/resolve/lib/async.js:46:17
    at process (/tmp/phaser-test/node_modules/resolve/lib/async.js:173:43)
    at ondir (/tmp/phaser-test/node_modules/resolve/lib/async.js:188:17)
    at load (/tmp/phaser-test/node_modules/resolve/lib/async.js:69:43)
    at onex (/tmp/phaser-test/node_modules/resolve/lib/async.js:92:31)
    at /tmp/phaser-test/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:123:15)

I need to manually require babelify and the presets but then it wont find any node module loaded by my source files.

I'm using node v6.9.1, npm 3.10.8 and Broccoli 1.1.0

stefanpenner commented 7 years ago

Currently this broccoli-plugin is not compatible with broccoli 1.x. (dowgrading to an ealier plugin may address) Or seeing of broccoli 1.x has a configurable tmpdir (may be just as simple as setting the posix tmp dir environment variable)

Why?

I believe it to be the following:

Potential steps on to address this:


I would love to address this, but this week is looking quite busy :(. If no-one gets to this, I will eventually get to it. Although it most likely wont be a prompt fix.

Oli4242 commented 7 years ago

I'm not really used to nodejs so I can't help… I downgraded to broccoli 0.16.9 and it worked. Thanks :)

greghuc commented 7 years ago

Just to say I also ran into this problem on updating to broccoli 1.1, and also downgraded to 0.16.9.

and2 commented 7 years ago

What worked for me was adding the absolute path to <project>/node_modules into browserify paths right after setting basedir. Not sure if there are still scenarios where browserify will fail.

this.options.browserify.paths = [ path.join(__dirname, '..') ]

mtimofiiv commented 7 years ago

I am also encountering this problem at the moment.

Error: Cannot find module 'reactify' from '/var/folders/hq/11q9dqkn6hn2xf14sx38s1rc0000gn/T/broccoli-70379Pylq7HZ0yROy/cache-1-watchify'
    at /Users/fiiv/dev/pinmark/frontend/node_modules/resolve/lib/async.js:48:31
    at processDirs (/Users/fiiv/dev/pinmark/frontend/node_modules/resolve/lib/async.js:182:39)
    at ondir (/Users/fiiv/dev/pinmark/frontend/node_modules/resolve/lib/async.js:197:13)
    at load (/Users/fiiv/dev/pinmark/frontend/node_modules/resolve/lib/async.js:80:43)
    at onex (/Users/fiiv/dev/pinmark/frontend/node_modules/resolve/lib/async.js:105:17)
    at /Users/fiiv/dev/pinmark/frontend/node_module

Is there any way around this besides downgrading broccoli?