1. Since version 5.2, NPM has added the NPX command. If the version is earlier than 5.2, you can manually install the command globally
npm install -g npx
Copy the code
2. Quick use of NPM module without global installation (after one-time installation and use)
-
Start a local static server with NPX instead of installing http-server globally
-
Create a project using the react scaffolding create-react-app.
NPM I http-serve-g, http-serve-g = "NPX http-serve-npm I @vue/cli -g, Vue create helloWord = "npx@vue /cli create helloWordCopy the code
3. Directly run the remote Git repository
npx github:piuccio/cowsay hello
Copy the code
4. Use NPX instead of NVM to switch node versions
- Use node 10.0.0 to NPM install
NPX -p [email protected] NPM installCopy the code
5. Expand your thinking
Can the front end directly run some remote OSS script to achieve the CDN upload of the project’s static resources