grunt-browserify icon indicating copy to clipboard operation
grunt-browserify copied to clipboard

Cannot find module './support/isBuffer'

Open ekkis opened this issue 10 years ago • 6 comments

I have a directory with tests I wish to browserify. if I do it by hand everything works fine:

$ cd tests/browser
$ browserify -o tests.js *.js

but in trying to automate it by putting the following into the Gruntfile.js:

browserify: {
    test: {
        src: ['test/browser/*.js'],
        dest: 'test/browser/tests.js'
    }
},

something goes wrong and when I try to run the tests I get:

$ grunt test-web Running "browserify:test" (browserify) task

Error: Cannot find module './support/isBuffer' from '/Users/ekkis/Development/tst/test/browser' Warning: Error running grunt-browserify. Use --force to continue.

Aborted due to warnings.

am I misconfiguring the plugin? help?

ekkis avatar Nov 19 '15 21:11 ekkis

I have the same problem, I think it's trying to look for node_modules/grunt-browserify/node_modules/browserify/node_modules/util/support/isBuffer.js but it's looking for it in the current project directory.

simonlovesyou avatar Jan 11 '16 12:01 simonlovesyou

I managed to fix my problem, seems like you can't use globbing patterns in files.src array if you also have a files.dest.

What caused my error:

files: {
  src: ['path/to/files/*.js'], 
  dest: 'whatever/file.js'
}

The fix:

files: {
  'whatever/file.js': ['path/to/files/*.js']
}

not sure if this is a bug or intentional.

simonlovesyou avatar Jan 11 '16 12:01 simonlovesyou

nah. you can use globs. I got it to work without changing the configuration but I no longer know what I did to make it work... I think I upgraded npm

ekkis avatar Jan 11 '16 17:01 ekkis

@ekkis I have the same problem. Could you find a solution to it?

chiragmongia avatar Aug 09 '16 10:08 chiragmongia

@chiragmongia do an upgrade first. I think that solved it for me

ekkis avatar Aug 09 '16 22:08 ekkis

Related issue here: https://github.com/browserify/browserify/issues/1531

felixhao28 avatar Jan 24 '18 03:01 felixhao28