<commit_before>/**!
 * cnpm - origin_npm.js
 *
 * Copyright(c) cnpmjs.org and other contributors.
 * MIT Licensed
 *
 * Authors:
 *  fengmk2 <<EMAIL>> (http://fengmk2.github.com)
 *  dead_horse <<EMAIL>> (http://deadhorse.me)
 */

'use strict';

/**
 * Module dependencies.
 */

require('colors');
var debug = require('debug')('cnpm');
var spawn = require('child_process').spawn;
var fs = require('fs');
var path = require('path');
var config = require('./config');
var parseArgv = require('./parse_argv');

var program = parseArgv();

var args = program.rawArgs.slice(2);

var CWD = process.cwd();

if (program.userconfig && !fs.existsSync(program.userconfig)) {
  // make sure userconfig exists
  // or it will throw: npm ERR! Error: default value must be string or number
  fs.writeFileSync(program.userconfig, 'email =\n');
}

args.unshift('--registry=' + program.registry);
args.unshift('--cache=' + program.cache);
args.unshift('--disturl=' + program.disturl);
args.unshift('--userconfig=' + program.userconfig);

var nodeModulesDir = path.join(__dirname, 'node_modules', '.bin');
var cmd = 'npm-beta';
if (process.platform === "win32") {
  cmd = 'npm-beta.cmd';
}
cmd = path.join(nodeModulesDir, cmd);

debug('%s %s', cmd, args.join(' '));<commit_msg>fix cnpm install cnpm fail bug<commit_after>/**!
 * cnpm - origin_npm.js
 *
 * Copyright(c) cnpmjs.org and other contributors.
 * MIT Licensed
 *
 * Authors:
 *  fengmk2 <<EMAIL>> (http://fengmk2.github.com)
 *  dead_horse <<EMAIL>> (http://deadhorse.me)
 */

'use strict';

/**
 * Module dependencies.
 */

require('colors');
var debug = require('debug')('cnpm');
var spawn = require('child_process').spawn;
var fs = require('fs');
var path = require('path');
var config = require('./config');
var parseArgv = require('./parse_argv');

var program = parseArgv();

var args = program.rawArgs.slice(2);

var CWD = process.cwd();

if (program.userconfig && !fs.existsSync(program.userconfig)) {
  // make sure userconfig exists
  // or it will throw: npm ERR! Error: default value must be string or number
  fs.writeFileSync(program.userconfig, 'email =\n');
}

args.unshift('--registry=' + program.registry);
args.unshift('--cache=' + program.cache);
args.unshift('--disturl=' + program.disturl);
args.unshift('--userconfig=' + program.userconfig);

var nodeModulesDir = path.join(__dirname, 'node_modules', '.bin');
var cmd = 'npm-beta';
if (process.platform === "win32") {
  cmd = 'npm-beta.cmd';
}
cmd = path.join(nodeModulesDir, cmd);

// if npm-beta not exists, use npm. happen on `$ cnpm install cnpm`
if (!fs.existsSync(cmd)) {
  cmd = 'npm';
  if (process.platform === "win32") {
    cmd = 'npm.cmd';
  }
}

debug('%s %s', cmd, args.join(' '));
{'fraction_non_alphanumeric': 0.19453672942045036, 'fraction_numerical': 0.004429678848283499, 'mean_word_length': 4.324165029469548, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2041057', 'n_tokens_mistral': 947, 'n_tokens_neox': 921, 'n_words': 227}