Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public getEnv() {
const PATH = pathKey();
const env = process.env;
const envPath = shellPath.sync().split(path.delimiter);
envPath.unshift(path.join(this.path, 'node_modules', '.bin'));
this.app.logger.info('env.pah:', process.env[PATH]);
// for electron fallback
const resourcesPath = process['resourcesPath']; // eslint-disable-line
if (resourcesPath) {
envPath.push(path.join(resourcesPath, 'bin'));
}
env[PATH] = envPath.join(path.delimiter);
this.app.logger.info('setEnv.pah:', env[PATH]);
// reset NODE_ENV
// in egg.js: Generally, before deploying the application, dependencies will be installed with NODE_ENV=production or --production
y: lastWindowState.y,
width: lastWindowState.width,
height: lastWindowState.height,
show: false
})
win.webContents.on('new-window', (e, url) => {
e.preventDefault()
shell.openExternal(url)
})
const RE = /Ready on http:\/\/localhost:(\d+)/
cmd = spawn('vue', ['ui', '--headless'], {
env: Object.assign({}, process.env, {
PATH: require('shell-path').sync()
})
})
cmd.stdout.on('data', chunk => {
const str = chunk.toString()
if (RE.test(str)) {
const [, port] = RE.exec(str)
win.loadURL(`http://localhost:${port}/project/select`)
win.show()
}
})
win.on('close', e => {
if (!isQuitting) {
e.preventDefault()
if (process.platform === 'darwin') {
module.exports = () => {
if (process.platform !== 'darwin') {
return;
}
process.env.PATH = shellPath.sync() || [
'./node_modules/.bin',
'/.nodebrew/current/bin',
'/usr/local/bin',
process.env.PATH
].join(':');
};
$rootScope.$on('dom:ready', () => {
$log.info('DOM is ready for npm');
//sync shell path or app will not work, yep.
process.env.PATH = require('shell-path').sync();
cp.exec('npm root -g', (err, stdout, stderr) => {
if (err) {
throw new Error(err);
}
if (stderr) {
$log.warn(stderr);
}
let globalFolder = stdout
, nodeModulesExt = ''; //important