Frontend Development 5 min read

Step-by-Step Guide to Installing Node.js, Vue CLI, and Creating a Uni‑App Project

This tutorial walks readers through installing Node.js, configuring npm or cnpm, upgrading the Vue CLI, creating a uni‑app project with Vue, troubleshooting common errors, and finally running the project in the WeChat Developer Tools, providing screenshots and command references throughout.

php中文网 Courses
php中文网 Courses
php中文网 Courses
Step-by-Step Guide to Installing Node.js, Vue CLI, and Creating a Uni‑App Project

First, download and install the latest Node.js version from the official website, then verify the installation with node -V . Node includes npm, which is required for later steps.

Next, install the Vue CLI globally using npm: npm install -g @vue/cli . If an older Vue CLI (2.9) is present, uninstall it with npm uninstall -g vue-cli and then install the newer version via cnpm to avoid network issues: npm install -g cnpm or npm install -g cnpm --registry=http://registry.npm.taobao.org . After cnpm is set up, reinstall the Vue CLI with cnpm install -g @vue/cli , confirming the version (>=3) with vue -V .

To create a uni‑app project, run the following command in a command‑prompt (preferably with administrator rights): vue create -p dcloudio/uni-preset-vue <project-name> . Accept the default options and press Enter. If the creation fails, run the command prompt as administrator, clear the npm cache with npm cache clean -f , update Node using npm install -g n and npm install -g n --force , then reinstall dependencies with npm install . After these steps, retry the project creation, e.g., vue create -p dcloudio/uni-preset-vue lottery .

Once the project is generated, navigate to its directory and start the WeChat Mini‑Program development server using npm run dev:mp-weixin . The command produces a dist folder, which should be imported into the WeChat Developer Tools. After importing, the tool will display the running mini‑program, confirming a successful setup.

The article concludes that the entire process—from installing Node.js and Vue CLI to creating and running a uni‑app project—provides a practical reference for beginners learning Vue and uni‑app development.

FrontendNode.jsWeChat Mini ProgramVuetutorialnpmuni-app
php中文网 Courses
Written by

php中文网 Courses

php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.