Every line of 'npm reinstall all packages' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
180 function installPackages() { 181 // cd ./output && elm-package install --yes && cd .. 182 return chdirInPromise(outputDir) 183 .then(() => { console.log(':: install Elm packages.'); }) 184 .then(execInPromise('elm-package', [ 'install', '--yes' ])) 185 .then(chdirInPromise('..')); 186 }
12 install(packages) { 13 return this.workspace.exec('yarn', [ 14 'add', 15 ...packages 16 ]) 17 }
101 async install(cwd: string) { 102 const command = /^win/.test(process.platform) ? 'npm.cmd' : 'npm'; 103 const args = ['install']; 104 return await spawnProcess(command, args, { cwd, stdio: 'inherit' }); 105 }
213 install () { 214 this.props.providers.forEach(provider => { 215 const type = provider === 'rest' ? 'express' : provider; 216 217 this.dependencies.push(`@feathersjs/${type}`); 218 219 if (provider === 'primus') { 220 this.dependencies.push('ws'); 221 } 222 }); 223 224 this._packagerInstall(this.dependencies, { 225 save: true 226 }); 227 228 if (this.isTypescript) { 229 const excluded = [ 230 'eslint', 231 'nodemon@^1.18.7', 232 ]; 233 this.devDependencies = this.devDependencies.concat([ 234 '@types/compression', 235 '@types/cors', 236 '@types/helmet', 237 '@types/serve-favicon', 238 'shx', 239 'ts-node-dev', 240 'tslint', 241 'typescript', 242 `@types/${this.props.tester}`, 243 `ts-${this.props.tester}`, 244 ]).filter(item => !excluded.includes(item)); 245 } 246 247 this.devDependencies.push(this.props.tester); 248 249 this._packagerInstall(this.devDependencies, { 250 saveDev: true 251 }); 252 }
128 async install() { 129 let auntyVersion; 130 131 try { 132 auntyVersion = requireg('@abcnews/aunty/package.json').version; 133 } catch (ex) { 134 // Nothing 135 } 136 137 const devDependencies = [`@abcnews/aunty${auntyVersion ? `@${auntyVersion}` : ''}`]; 138 const dependencies = []; 139 140 switch (this.options.template) { 141 case 'preact': 142 devDependencies.push('html-looks-like', 'preact-render-to-string'); 143 dependencies.push('preact', 'preact-compat'); 144 break; 145 case 'react': 146 devDependencies.push('react-test-renderer'); 147 dependencies.push('react', 'react-dom'); 148 break; 149 case 'vue': 150 devDependencies.push('@vue/test-utils'); 151 dependencies.push('vue'); 152 break; 153 default: 154 break; 155 } 156 157 const allDependencies = [].concat(devDependencies).concat(dependencies); 158 const projectDirectoryName = this.options.path.split('/').reverse()[0]; 159 160 if (allDependencies.includes(projectDirectoryName)) { 161 throw new Error( 162 `npm will refuse to install a package ("${projectDirectoryName}") which matches the project directory name.` 163 ); 164 } 165 166 await installDependencies(devDependencies.sort(), ['--save-dev'], this.log); 167 await installDependencies(dependencies.sort(), null, this.log); 168 }
68 function npmInstall(pkgs, location) { 69 const pkgsInstallData = []; 70 71 pkgs = _.map(pkgs, pkg => { 72 if (!pkg.type) { 73 pkg.type = 'dep'; 74 } 75 if (pkg.version) { 76 pkg.name = pkg.name + '@' + pkg.version; 77 } 78 return pkg; 79 }); 80 81 _.forEach(flags, (flag, key) => { 82 const pk = _.remove(pkgs, { type: key }); 83 if (_.isEmpty(pk)) return; 84 pkgsInstallData.push({ 85 pkgs: _.map(pk, 'name'), 86 flag 87 }); 88 }); 89 90 return bluebirdPromise.map(pkgsInstallData, x => { 91 return npmInstallWithFlag(x.pkgs, x.flag, location); 92 }); 93 94 }
20 async installPackages(dependencies) { 21 new Listr([ 22 { 23 title: 'Removing package-lock', 24 task: () => false 25 }, 26 { 27 title: 'Running npm install', 28 task: () => execa('echo', ['install']) 29 }, 30 { 31 title: 'Adding package-lock to git', 32 task: (ctx, task) => 33 execa('echo', ['add', 'HIII']) 34 .catch(() => task.skip()) 35 } 36 ]).run(); 37 }
42 async install() { 43 console.log('about to install', [this.nameAndVersion], process.cwd()) 44 await npm.install([this.nameAndVersion], { save: true, cwd: process.cwd() }) 45 }
27 module.exports = function install( 28 // npm package names, which may be in package@version format 29 packages, 30 options, 31 cb 32 ) { 33 const { check = false, cwd = process.cwd(), dev = false, save = false } = options; 34 35 if (check) { 36 // eslint-disable-next-line no-param-reassign 37 packages = packages.filter(pkg => { 38 // Assumption: we're not dealing with scoped packages, which start with @ 39 const name = pkg.split('@')[0]; 40 try { 41 resolve.sync(name, { basedir: cwd }); 42 return false; 43 } catch (e) { 44 return true; 45 } 46 }); 47 } 48 49 if (packages.length === 0) { 50 return process.nextTick(cb); 51 } 52 53 let npmArgs = ['install', '--silent', '--no-progress', '--no-package-lock']; 54 55 if (save) { 56 npmArgs.push(`--save${dev ? '-dev' : ''}`); 57 } 58 59 npmArgs = npmArgs.concat(packages); 60 61 const spinner = ora(`Installing ${joinAnd(packages)}`).start(); 62 const npm = spawn('npm', npmArgs, { cwd, stdio: ['ignore', 'pipe', 'inherit'] }); 63 npm.on('close', code => { 64 if (code !== 0) { 65 spinner.fail(); 66 cb(new Error('npm install failed')); 67 return; 68 } 69 spinner.succeed(); 70 cb(); 71 }); 72 };
9 export function installNPMDependencies(ctx: BuildContext) { 10 return new Promise((resolve, reject) => { 11 exec(`npm install`, { 12 cwd: ctx.projectFolder, 13 }, (error, stdout) => { 14 15 if (error === null) { 16 resolve(); 17 } else { 18 reject(Error(stdout)); 19 } 20 }); 21 }); 22 }