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

Base directory for node_modules with Node integration #1971

Closed
mattdesl opened this issue Jun 15, 2015 · 2 comments
Closed

Base directory for node_modules with Node integration #1971

mattdesl opened this issue Jun 15, 2015 · 2 comments

Comments

@mattdesl
Copy link
Contributor

I'm trying to figure out how to configure the base directory for the Node-integrated require() statements in the browser process. My end goal is running Electron on regular Node.js sources that may require native modules (like fs or node-opencv). (The gory details.)

With the following, for example, after npm install save-pixels --save

var save = require('save-pixels')

This works when I run electron server.js from the same directory. However, say I am running this from an entirely different folder with its own modules:

projects
    app/
        node_modules
        server.js
    my-module/
        node_modules

Trying to run electron ../app/server.js from the my-module folder still seems to look inside app/node_modules rather than the calling folder.

Thanks. 😄

@zcbenz
Copy link
Member

zcbenz commented Jun 16, 2015

You can set NODE_PATH environment variable to override the default search paths.

Electron apps are mostly used as GUI apps, so current directory usually doesn't affect module search paths.

@zcbenz zcbenz closed this as completed Jun 16, 2015
@mattdesl
Copy link
Contributor Author

Thanks !

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

2 participants