vue-cli是vue的脚手架,可以快捷的创建vue项目。
node.js是一个基于chrom V8的javascript的运行时环境,和java的jvm类似
npm 是node.js的包管理工具,node package manage。
安装vue-cli
npm install -g @vue/cli
npm install -g @vue/cli --force
卸载vue-cli
npm uninstall -g @vue/cli
npm uninstall -g @vue/cli --force
安装完成查看版本
vue --version
//局部
npx vue --version
创建项目
vue create xxxx
//局部
npx @vue/cli create xxxx
问题1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @apollo/protobufjs@1.2.7 postinstall: `node scripts/postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @apollo/protobufjs@1.2.7 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jianbin.xiao\AppData\Roaming\npm-cache\_logs\2023-12-29T06_24_35_143Z-debug.log
Install for [ '@vue/cli@latest' ] failed with code 1
解决办法
npm install --loglevel silent -g @apollo/protobufjs
//或者
npm install --loglevel silent -g
问题2
拒绝访问。
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! core-js@3.37.1 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the core-js@3.37.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jianbin.xiao\AppData\Roaming\npm-cache\_logs\2024-07-25T07_19_03_151Z-debug.log
ERROR Error: command failed: npm install --loglevel error
Error: command failed: npm install --loglevel error
解决办法
npm config set ignore-scripts true
//或者
npm install core-js@3.8.1
然后重新创建相同项目名-》merge(合并项目)