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

Does not work in phantomjs: process is undefined #7

Open
jdpopkin opened this issue Jan 1, 2016 · 5 comments
Open

Does not work in phantomjs: process is undefined #7

jdpopkin opened this issue Jan 1, 2016 · 5 comments

Comments

@jdpopkin
Copy link

jdpopkin commented Jan 1, 2016

This module implicitly depends on process, which isn't defined outside of Node. Prior to a2f87c3, this module had an extra var process = process || {}; in path.js that allowed the use of functions that don't meaningfully rely on process.

And since it sounds like people shouldn't be using this module in Node itself (#6), this problem might affect most legitimate users of this module.

See philc/vimium@da57280 for an example of a legitimate use of this library that was broken by the removal of var process = process || {};.

@jdpopkin jdpopkin changed the title Does not work in phantomjs Does not work in phantomjs: process is undefined Jan 1, 2016
@gcmeen
Copy link

gcmeen commented Dec 15, 2016

Got following error while generating pdf using Phantom-pdf package:

Checking if phantomjs is installed in provided path: phantomjs
ReferenceError: Can't find variable: process

F:/Projects/Javandi/node_modules/path/path.js:25
F:/Projects/Javandi/node_modules/path/path.js:629

does not works with phantomjs??? could anybody help me how to fix this error???

@Download
Copy link

Download commented Apr 4, 2017

Workaround:

Before you require('path'), do:

window.process = {};

This will create a (dummy) variable process so the error goes away.

@lancewf
Copy link

lancewf commented Sep 7, 2018

This is also a problem for anyone using Angular 6 with this library.

Below is the line that I am seeing that fails in Angular 6.
https://github.com/jinder/path/blob/master/path.js#L25

Below is a link to Angular saying that they remove the nodejs shims
angular/angular-cli#9827 (comment)

@japo32
Copy link

japo32 commented Oct 5, 2018

@lancewf we're you able to find a solution for this?

@gongzhxu
Copy link

gongzhxu commented Apr 24, 2023

define process.env in vite.config.js file

export default defineConfig({
  plugins: [
    vue()
  ],
  define: {
    'process.env': {}
  }
})

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

6 participants