How to use the npm.prefix function in npm

To help you get started, we’ve selected a few npm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ThomasShaped / GaymersBot / plugins.js View on Github external
}, function (err) {
            // catch errors
            if (plugin_directory != "./plugins/"){ //install plugin modules for Electrify builds
                npm.prefix = exec_dir;
                console.log(npm.prefix);
            }
            npm.commands.install(deps, function (er, data) {
                if(er){
                    console.log(er);
                }
                console.log("Plugin preload complete");
                load_plugins()
            });

            if (err) {
                console.log("preload_plugins: " + err);
            }
        });
    } else {
github repetere / periodicjs / scripts / npmhelper.js View on Github external
},function (err) {
				if (err) {
					callback(err,null);
				}
				else {
				 	npm['no-optional'] = true;
				 	npm['save-optional'] = false;
				 	npm.production = true;
				 	npm.silent = true;
				 	npm.skip_post_install = true;
				 	npm.quiet = true;
				 	npm.prefix = prefixpath;
				 	remove_installed_periodic_from_node_modules({prefixpath:prefixpath},(err)=>{
				 		if (err){ throw err;}
				 						 	// console.log('installMissingNodeModules npm',npm);
					 	try{
							npm.commands.i([],
							function (err,data ) {
								console.log('trying to restore conf in installMissingNodeModules',data);

								// console.log('installMissingNodeModulesAsync extension_config_path',extension_config_path);
								// console.log('installMissingNodeModulesAsync initialExtensionConf',initialExtensionConf);
								fs.writeJSONSync(extension_config_path,initialExtensionConf);
								console.log('restored conf in installMissingNodeModules');
								if (err) {
									console.log('installMissingNodeModules err',err);
									callback(err,null);
								}
github spmjs / spm / lib / core / plugin_config.js View on Github external
npm.load({}, function (er) {
        if (er) {
          throw new Error('插件 ' + generatePluginId(obj) + ' 依赖模块下载失败');
        } 

        // 把安装的模块安装到 ~/.spm/sources/ 插件的 node_moduels
        npm.prefix = dir;

        var installMods = _.keys(deps).map(function(dep) {
          return dep + '@' + deps[dep];
        });

        npm.commands.install(installMods, function (er, data) {
          if (er) {
            throw new Error('插件 ' + generatePluginId(obj) + ' 依赖模块下载失败');
          } 

          replacePluginRequire(dir, deps); 
          cacheModule(key, dir, obj, config);
          callback();
        });
      })
    } else {
github ender-js / Ender / lib / ender.npm.js View on Github external
var localInstall = packages.some(function (item) {
              // this is a hack because of REEEIDD! DAMN YOU REEIIDD!
              // https://github.com/isaacs/npm/commit/8b7bf5ab0c214b739b5fd6af07003cac9e5fc712
              return path.resolve(item) == npm.prefix
            })
github ShiftNrg / shift / modules / dapps.js View on Github external
npm.load(config, function (err) {
		if (err) {
			return setImmediate(cb, err);
		}

		npm.root = path.join(dappPath, 'node_modules');
		npm.prefix = dappPath;

		npm.commands.install(function (err, data) {
			return setImmediate(cb, null);
		});
	});
};
github goodeggs / clingwrap / lib / clingwrap.js View on Github external
npm.load(function (err) {
    if (err) return cb(err)
    var file = path.resolve(npm.prefix, 'npm-shrinkwrap.json')
    fs.readFile(file, 'utf8', function (err, data) {
      cb(err, data && JSON.parse(data))
    });
  })
}
github handsontable / hot-builder / lib / builder.js View on Github external
npm.load(this.builderPackage, function(err) {
    if (err) {
      return err;
    }
    var orgPrefix = npm.prefix;

    if (version === 'link') {
      npm.prefix = __dirname + '/..';
      npm.commands.link('handsontable', callback);
      npm.prefix = orgPrefix;
    }
    else {
      npm.commands.install(__dirname + '/..', ['git://github.com/handsontable/handsontable#' + version], callback);
    }
  });
};
github handsontable / hot-builder / lib / builder.js View on Github external
npm.load(this.builderPackage, function(err) {
    if (err) {
      return err;
    }
    var orgPrefix = npm.prefix;

    if (version === 'link') {
      npm.prefix = __dirname + '/..';
      npm.commands.link('handsontable', callback);
      npm.prefix = orgPrefix;
    }
    else {
      npm.commands.install(__dirname + '/..', ['git://github.com/handsontable/handsontable#' + version], callback);
    }
  });
};
github Ebookcoin / ebookcoin / modules / dapps.js View on Github external
npm.load(config, function (err) {
		if (err) {
			return setImmediate(cb, err);
		}

		npm.root = path.join(dappPath, "node_modules");
		npm.prefix = dappPath;

		npm.commands.install(function (err, data) {
			if (err) {
				setImmediate(cb, err);
			} else {
				return setImmediate(cb, null);
			}
		});
	});
}
github apmjs / apmjs / src / utils / npm.js View on Github external
get: () => {
      return npm.prefix
    }
  },