magento小白一个,正在学习ing…
一、安装环境
- 在Linux环境最好(Windows 先下载安装ubuntu, vscode安装remote-wsl插件)
- 在ubuntu安装好nvm(node版本控制管理器),下载14.18.3版本node并使用(
nvm install 14.18.3
+nvm use 14.18.3
),再安装yarn(npm install yarn -g
)
二、下载安装项目
yarn create @magento/pwa
( 如果有选择Magento Store Edition的可以选择CE社区版,不用给钱)
- 我的项目名称是jane-pwa-studio
- 进入项目
cd jane-pwa-studio
- 现在如果直接
yarn watch
,会出现10000的端口,但还是不能直接使用,所以先创建本地的hostname 和 ssl 证书,使用命令yarn buildpack create-custom-origin ./
- yarn watch,现在还是不能使用,因为host没有配置的原因
- 进入本地的host代理
C:\Windows\System32\drivers\etc
找到host
文件,右键->打开方式->记事本
- 最后一排添加:127.0.0.1 代理地址
example:127.0.0.1 jane-pwa-studio-9sgk2.local.pwadev
jane-pwa-studio-9sgk2.local.pwadev是我本地第6步生成的代理地址 - 这时候再点开就可以用了,打开是venia的模板
magento-pwa基础项目的搭建到这里就结束了,更多学习请持续关注vx 公众号:简学前端