cloudfoundry-community / node-cfenv

easy access to your Cloud Foundry application environment for node
Apache License 2.0
74 stars 20 forks source link

Error on using require('cfenv') #46

Closed crajar closed 4 years ago

crajar commented 4 years ago

I'm trying to use cfenv for a react project hosted on cloud foundry.

In the app, when I try to use require('cfenv'), I get the following error:

index.js:117 Uncaught TypeError: Arguments to path.join must be strings
    at index.js:117
    at Array.filter (<anonymous>)
    at filter (index.js:287)
    at Object.push../node_modules/path-browserify/index.js.exports.join (index.js:115)
    at getPortsFile (index.js:62)
    at Object.<anonymous> (index.js:13)
    at Object../node_modules/ports/index.js (index.js:65)
    at __webpack_require__ (bootstrap:784)
    at fn (bootstrap:150)
    at Object.<anonymous> (cfenv.js:13)
    at Object../node_modules/cfenv/lib/cfenv.js (cfenv.js:314)
    at __webpack_require__ (bootstrap:784)
    at fn (bootstrap:150)

What am I missing here?

pmuellr commented 4 years ago

This package can't be used in the browser, it's intended for use on a server.

I'm assuming you're trying to use it in a browser given the references to react and webpack.

Going to close, but re-open if I misinterpreted.