Skip to content
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

Error when browserField: false and process is used #1835

Open
kumavis opened this issue May 22, 2018 · 4 comments · May be fixed by #1959
Open

Error when browserField: false and process is used #1835

kumavis opened this issue May 22, 2018 · 4 comments · May be fixed by #1959
Labels

Comments

@kumavis
Copy link
Contributor

kumavis commented May 22, 2018

Error: Cannot find module '_process' from '/Users/xyz/dev/metamask-extension/mascara/src'

╭─xyz@xyzs-MacBook-Pro ~/dev/browserify-test  
╰─$ echo 'console.log(process.env)' > index.js
╭─xyz@xyzs-MacBook-Pro ~/dev/browserify-test  
╰─$ browserify --no-browser-field index.js > bundle.js
Error: Cannot find module '_process' from '/Users/xyz/dev/browserify-test'
    at /Users/xyz/.nvm/versions/node/v8.9.4/lib/node_modules/browserify/node_modules/resolve/lib/async.js:48:31
    at processDirs (/Users/xyz/.nvm/versions/node/v8.9.4/lib/node_modules/browserify/node_modules/resolve/lib/async.js:182:39)
    at ondir (/Users/xyz/.nvm/versions/node/v8.9.4/lib/node_modules/browserify/node_modules/resolve/lib/async.js:197:13)
    at load (/Users/xyz/.nvm/versions/node/v8.9.4/lib/node_modules/browserify/node_modules/resolve/lib/async.js:80:43)
    at onex (/Users/xyz/.nvm/versions/node/v8.9.4/lib/node_modules/browserify/node_modules/resolve/lib/async.js:105:17)
    at /Users/xyz/.nvm/versions/node/v8.9.4/lib/node_modules/browserify/node_modules/resolve/lib/async.js:26:73
    at FSReqWrap.oncomplete (fs.js:152:21)
@marriskleinert
Copy link

marriskleinert commented Jun 7, 2019

Same problem here...
Any workarounds for that?

PS x_x_x_x_x_x\server> npm run bundle

> dashboard@0.0.1 bundle x_x_x_x_x_x\server
> browserify bin/index.js -o server.js --node --u bufferutil --u utf-8-validate --detect-globals false

Error: ENOENT: no such file or directory, lstat 'x_x_x_x_x_x\server\process'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dashboard@0.0.1 bundle: `browserify bin/index.js -o server.js --node --u bufferutil --u utf-8-validate --detect-globals false`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dashboard@0.0.1 bundle script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     x_x_x_x_x_x\AppData\Roaming\npm-cache\_logs\2019-06-07T14_58_25_345Z-debug.log

@marriskleinert
Copy link

Found a mistake in our code. We imported process but we should've used the global Node.js variable.
Maybe also a solution in your case? @kumavis

@goto-bus-stop
Copy link
Member

Found a mistake in our code. We imported process but we should've used the global Node.js variable.

it's not really a mistake on your end, since both are valid in Node.js. but only the global works in browserify at the moment, yes.

The OP in this issue was using the global variable but it's giving this error anyway when combined with the --no-browser-field flag.

@marriskleinert
Copy link

Alright, thanks for the explanation :)

toshiyuki-rs added a commit to toshiyuki-rs/browserify that referenced this issue Apr 15, 2020
It was caused by injecting `require('process')` line, even if you
set browseField false

fix browserify#1835
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants