Let’s cut to the chase
I use Cordova to create projects and add platforms. The following Tips are stuck here
MacBook-Pro:cordova-demo kuiper$ cordova platform add android
Using cordova-fetch for cordova-android@^8.0. 0
(node:42257) Warning: Accessing non-existent property 'android' of module exports inside circular dependency
(Use `node --trace-warnings ... ` to show where the warning was created)
Copy the code
The reason is that the node.js version is too high and needs to be lowered
# Current Node version
MacBook-Pro:cordova-demo kuiper$ node -v
v1415.. 0
Copy the code
Practice: Use Node version management tool n to switch to an earlier version
# global install n
sudo npm install n -g
Install different Node versions using n
Sudo n Version number
# list installed versions for version selection
sudo n
Copy the code
View historical Node versionsportal
Install v10.23.0
Macbook-pro :cordova- Demo Kuiper $sudo n V10.23.0
Installing: node - v10.23.0
mkdir : /usr/local/ n/versions/node / 10.23.0
Fetch: https://nodejs.org/dist/v10.23.0/node-v10.23.0-darwin-x64.tar.xz
Installed: V10.23.0 (with NPM 6.14.8)
Check the installed version and switch to version 10.23.0
The node / 10.23.0
&western node / 14.15.0
Use up/down arrow keys to select a version, return key to install, d to delete, q to quit
# Check the current version
MacBook-Pro:cordova-demo kuiper$ node -v
v10.23.0
Copy the code
Create a new project using Cordova and add a platform.
MacBook-Pro:cordova-demo kuiper$ cordova platform add android
Using cordova-fetch forCordova - android @ ^ 8.0.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: io.cordova.hellocordova
Name: HelloCordova
Activity: MainActivity
Android target: android-28
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
Copy the code