node:spawn npm ENOENT

错误背景

封装脚手架时报错

错误原因

windows系统原因

解决方案

const createProjectAction = async (project) => {
  console.log("why help you create your project")
  // 1.clone项目
  await download(vueRepo,project,{clone:true})
  //2.执行npm install
  // await commandSpawn('npm', ['install'],{cwd: `./${project}`})
  await commandSpawn(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['install'], { cwd: `./${project}` })
}

node:spawn npm ENOENT

上一篇:无法远程排查思路和解决办法


下一篇:Windows server 2008和centos 7安装jdk