path
path copied to clipboard
Does not work in phantomjs: process is undefined
This module implicitly depends on process, which isn't defined outside of Node. Prior to a2f87c3ae9b698f3f085c344714fbd4376905e22, 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 https://github.com/philc/vimium/commit/da57280c3e2ec80cf8e98c8634305e59b8f52f53 for an example of a legitimate use of this library that was broken by the removal of var process = process || {};.
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???
Workaround:
Before you require('path'), do:
window.process = {};
This will create a (dummy) variable process so the error goes away.
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 https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814
@lancewf we're you able to find a solution for this?
define process.env in vite.config.js file
export default defineConfig({
plugins: [
vue()
],
define: {
'process.env': {}
}
})