背景:换电脑,需要重新安装前端环境,再此做个列表,需要安装什么
1、安装vscode
2、安装 vscode插件



3、安装git(默认位置安装)
4、安装git管理工具sourcetree
- Sourcetree克隆gitee上面的项目
- 复制https链接
- Sourcetree中clone,输入链接,克隆即可
5、安装snipaste 快捷截图F1,贴图F3
6、设置谷歌浏览器
7、安装nvm(默认位置安装)
8、安装nodejs(默认位置安装C:\Program Files\nodejs\)
中间出现问题不能全局使用npm,解决方案:npm : 无法加载文件E:\NodeJS\npm.ps1。此系统上禁止运行脚本。【解决】_npm无法加载文件npm.ps1-CSDN博客
出现问题vscode中能执行node-v不能npm-v;hbuliderX和cmd中都能正常执行。原因是vscode中使用的是powershell终端,系统默认的执行策略可能禁止运行脚本,而hbuliderx用的是类型终端,不存在这个个问题。可以在powershell中输入一下命令,将执行策略修改为RemoteSigned,允许运行本地脚本。命令:Set-ExecutionPolicyRemoteSigned -Scope CurrentUser
9、安装pnpm,切换npm下载源为国内地址
npm install pnpm-g安装pnpm pnpm -v查看是否安装完成 npm get registry查看npm下载源地址
npm config setregistry https://registry.npmmirror.com/修改npm下载源地址
npm get registry查看地址是否修改成功
10、安装hbuilderX
11、安装微信开发工具
12、安装mysql
端口3306 密码123456 安装位置D:\software\mysql\install-directory 数据存储位置D:\software\mysql\data-directory
运行命令:mysql -uroot -p
安装详细步骤参考:Mysql超详细安装配置教程(保姆级)_mysql安装及配置超详细教程-CSDN博客
13、安装navicat
注册达到上限解决文章参考:Navicat激活失败、激活次数上限、90010003。不断网激活_激活失败。原因可能是由于已达到激活次数的上限。请检查你是否已在卸载或重新安装-CSDN博客
14、node项目创建数据库并链接mysql(navicat)
Navicat中操作步骤:在navicat中先创建链接,再在链接下创建数据库,再在数据库下表中创建数据表,设计数据表字段,打开数据表查看数据
Nodei项目中步骤:先创建一个js文件,里面写上要连接的这个数据库的信息并导出
const configs = {
mysql: {
host: "192.168.31.75" ,
user: "root" ,
password: "123456" ,
database: "test" ,
},
};
module . exports = configs ; // Export theconfiguration object for use in other files
随后在项目启动文件app.js中,导入上述配置文件,导入mysql,创建链接,打开链接,查询数据库,关闭连接
~~~
const express = require ( "express" );
const app = express (); // Create aninstance of an Express application
const port = 3000 ;
// 导入配置
const configs = require ( "./config.js" );
app . get ( "/" , ( req , res ) => {
// Handle GETrequest to the root path
console . log ( "Requestreceived" );
});
var mysql = require ( "mysql" ); // Import theMySQL module
// Create aconnection to the MySQL database
var connection = mysql . createConnection ( configs . mysql );
// Connect tothe MySQL database
connection . connect (( err ) => {
if ( err ) {
console . error ( "Errorconnecting to MySQL:" , err );
return ;
}
console . log ( "Connectedto MySQL database" );
});
connection . query ( "SELECT 1+1AS solution" , function ( err , rows , fields ) {
if ( err ) {
console . error ( "Errorexecuting query:" , err );
return ;
}
console . log ( "Thesolution is: " , rows [ 0 ]. solution ); // Log theresult of the query
});
connection . end ();
app . listen ( port , () => {
console . log ( `Server isrunning on http://localhost: ${ port } ` ); // Log theserver URL to the console
});
参考:Node.js 连接mysql 数据库(Navicat)超详细!!!_如何使用navicat 运行 .js脚本-CSDN博客
解决问题文章(创建好数据库数据表,node中配置好,运行项目时报错Error connecting to MySQL: Error: ER_HOST_NOT_PRIVILEGED: Host 'ys'is not allowed to connect to this MySQL server):拯救报错:Error:ER_HOST_NOT_PRIVILEGED: Host ‘x.x.x.x‘ is not allowed to connect to this MySQLserver_er host not pr-CSDN博客
15、安装postman / apifox