async install(version) {
    const {
      packageName, registry, root,
    } = this;

    try {
      const tmpPath = tmp.dirSync().name;
      const registryCmd = registry ? `--registry=${registry}` : '';
      const cmd = `
      npm install --prefix=${libPath.resolve(tmpPath)} ${packageName}@${version || 'latest'} -g ${registryCmd}
    `;

      const { stderr } = await exec(cmd.trim());

      if (stderr && stderr.indexOf('WARN') === -1) {
        throw new Error(stderr);
      }
      const pkgFileLib = libPath.join(tmpPath, 'lib/node_modules', packageName, 'package.json');
      const pkgFileLibExist = fs.existsSync(pkgFileLib);
      const tmpFolder = pkgFileLibExist
        ? libPath.join(tmpPath, 'lib/node_modules', packageName)
        : libPath.join(tmpPath, 'node_modules', packageName);

      const installedVersion = (() => {
        const pkginfo = require(libPath.join(tmpFolder, 'package.json'));
        return (pkginfo && pkginfo.version) || '';
      })();
      if (!installedVersion) {
        throw new Error('no version installed');
      }

      const destFolder = libPath.join(root, installedVersion);
      fs.copySync(tmpFolder, destFolder, {
        dereference: true, // ensure linked folder is copied too
      });
    } catch (e) {
      throw new Error(`install failed: ${e}`);
    }
  }
@param {string|undefined} version
@returns {Promise<void>}