Every line of 'reinstall npm' 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.
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 }
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 }
26 installNpmPackage(name: string, version: string | null | undefined, cwd: string = this.scopes.localPath) { 27 const versionWithDelimiter = version ? `@${version}` : ''; 28 const cmd = `npm i --save ${name}${versionWithDelimiter}`; 29 return this.command.runCmd(cmd, cwd); 30 }
47 async installPackage(pkg: string, dev?: boolean) { 48 const { 49 filesystem: { exists }, 50 print, 51 system 52 } = this.context 53 54 const count = pkg.split(' ').length 55 const w = `${dev ? 'development ' : ''}package${count > 1 ? 's' : ''}` 56 const spinner = print.spin(`Adding ${w} into project...`) 57 58 const yarn = exists('yarn.lock') === 'file' 59 const cmd = `${yarn ? 'yarn add' : 'npm install'} ${ 60 dev ? '-D' : yarn ? '' : '-S' 61 } ${pkg}` 62 await system.run(cmd) 63 spinner.succeed(`${count} ${w} were successfully added.`) 64 }
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 }
12 install(packages) { 13 return this.workspace.exec('yarn', [ 14 'add', 15 ...packages 16 ]) 17 }
57 install() { 58 59 // related to janky code above--even if we rename the files the original 60 // gradle style directories (src/main/ui/...) are still around so we need to 61 // clean up those (empty) gradle-esque directories 62 if (this.props.buildsys == 'npm') { 63 rimraf('./src/main', function (err) { 64 if (err) throw err; 65 }); 66 } 67 68 this.log("Initializing the project--this may take a few minutes..."); 69 if (this.props.buildsys == 'npm/yarn') { 70 if (this.props.packageManager == 'npm') { 71 this.npmInstall([],{ 'no-optional': true, "loglevel": "error" }); 72 } else { 73 this.yarnInstall([],{ 'ignore-optional': true }); 74 } 75 } else { 76 var done = this.async(); 77 this.spawnCommand('gradle',['npmInstall']).on('close', done); 78 } 79 }
30 async function forceReinstallNpmDependencies(projectPath: string):Promise { 31 rimraf.sync(`${path.normalize(projectPath)}/node_modules`); 32 rimraf.sync(`${path.normalize(projectPath)}/package-lock.json`); 33 await executeCommand(projectPath, 'npm install', true); 34 }
30 function _install({ yarn = false 31 , npm = false 32 , yarnInstallMessage = YARN_INSTALL_MESSAGE 33 , npmInstallMessage = NPM_INSTALL_MESSAGE 34 , yarnAutodetectMessage = YARN_AUTODETECT_MESSAGE 35 , npmAutodetectMessage = NPM_AUTODETECT_MESSAGE 36 , verbose = false 37 } = {}, cb) { 38 const opts = { yarn, npm, yarnInstallMessage, npmInstallMessage, yarnAutodetectMessage, npmAutodetectMessage, verbose } 39 shouldUseYarn({ yarn, npm }, (useYarn) => { 40 try { 41 const autodetect = !yarn && !npm 42 const message = autodetect ? (useYarn ? yarnAutodetectMessage : npmAutodetectMessage) : (useYarn ? yarnInstallMessage : npmInstallMessage) 43 console.log(message) 44 const executable = useYarn ? 'yarn' : 'npm' 45 const args = (useYarn ? [] : [ 'install', verbose ? '--verbose' : '--silent' ]).filter((e) => { return e }) 46 47 spawn( 48 executable 49 , args 50 , { stdio: 'inherit' } 51 ).on('close', (code, ...args) => { 52 if (code !== 0) { 53 if(useYarn) { 54 fallback(opts, cb) 55 } else { 56 installFail(code, ...args) 57 } 58 } else { 59 cb() 60 } 61 }) 62 } catch(err) { 63 if(useYarn) { 64 fallback(opts, cb) 65 } else { 66 installFail(1, util.inspect(err)) 67 } 68 } 69 }) 70 }
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 }