Skip to content

Error: Cannot find module 'pg-native' from '....projectFolder/node_modules/pg/lib/native' #904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kulikalov opened this issue Dec 22, 2015 · 4 comments

Comments

@kulikalov
Copy link

I'm receiving this error when i'm trying to create a bundle with gulp, browserify and babelify.

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

Error: Cannot find module 'pg-native' from '[projectFolder]/node_modules/pg/lib/native'
    at [projectFolder]/node_modules/browserify/node_modules/resolve/lib/async.js:46:17
    at process ([projectFolder]/node_modules/browserify/node_modules/resolve/lib/async.js:173:43)
    at ondir ([projectFolder]/node_modules/browserify/node_modules/resolve/lib/async.js:188:17)
    at load ([projectFolder]/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
    at onex ([projectFolder]/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
    at [projectFolder]/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:82:15)

I've tried all suggested solutions from here:
#127
it doesn't help.
node v4.1.1 (npm v2.14.4)

gulp task:

gulp.task('buildServer', function() {
  return browserify('./server/server.js')
    .transform(babelify)
    .bundle()
    .pipe(source('server.js'))
    .pipe(buffer()) 
    // .pipe(uglify())
    .pipe(gulp.dest('./'));
});
@brianc
Copy link
Owner

brianc commented Dec 22, 2015

Are you trying to bundle node-postgres into the browser? I'm not sure that's going to work. It relies on some compiled parts as well as net.Socket

@kulikalov
Copy link
Author

i see, my mistake. I'm working on frontend mostly, so i've didn't event noticed, that browserify does not suppose to do that. Could you suggest simple solution to bundle js files (with es6) into single file and uglify it?

@brianc
Copy link
Owner

brianc commented Dec 22, 2015

I use webpack myself. ;) Seriously though I am not sure about browserify,
you'd be better served looking for info somewhere else on the internet for
how to use it.

On Tue, Dec 22, 2015 at 8:43 AM, mdcsfk [email protected] wrote:

i see, my mistake. I'm working on frontend mostly, so i've didn't event
noticed, that browserify does not suppose to do that. Could you suggest
simple solution to bundle js files (with es6) into single file and uglify
it?


Reply to this email directly or view it on GitHub
#904 (comment)
.

@brianc brianc closed this as completed Dec 22, 2015
@evbo
Copy link

evbo commented May 17, 2020

fyi, this fix appears in multiple issues and may be the best path forward, as of pg 8.2.1:

#838 (comment)
#1187 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants