To learn more about how to use nvm, click here. So features may or may not match what is ultimately released. This may simply reinstall the current version, depending on the development cycle. If you want to try the next, unreleased version of npm to test that packages you have created will work with the planned next release of npm, use this command: LinuxĬlick here to learn how to install nvm for Linux. To install and manage npm and Node.js on Windows, we suggest nvm-windows. Apple macOSĬlick here to learn how to install nvm for MacOs. If you decide to install a version manager, use the instructions for the version manager you select to learn how to switch versions, and to learn how to keep up-to-date with the latest version of npm. This makes it easier to ensure that your applications work for most users, even if they are using other versions of npm. The nvm enables you to easily switch npm as well as node versions. In addition, developers can use an nvm to test their applications on multiple versions of npm. The version manager will avoid permissions errors, and will solve the complexities of updating Node.js and npm. To solve both these issues, many developers opt to use a node version manager, or nvm, to install npm. This can cause permissions errors when you attempt to run packages globally. Also, the Node.js installation process installs npm in a directory that only has local permissions. Since npm and node.js products are managed by different entities, updates and maintenance can become complex. Using a Version Manager to install Node.js and npm To install a version that will be released in the future, run: This will install the latest official, tested version of npm. If the version you see does not match the latest version, run: To be sure that this matches the latest version, scroll to the bottom of this page. However, npm gets updated more frequently than Node.js, so be sure that you have the latest version. When you install node.js, npm is automatically installed. If you're using Linux, you can find installers by scrolling on the Node.js download page, or, check NodeSource's binary distributions to see if there's a more recent version that works with your system.Īfter installing, run node -v. Other versions have not yet been tested with npm. Be sure to install the version labeled LTS. If you're using OS X or Windows, use one of the installers from the Node.js download page. You can always change how you run npm in the future. If you aren't sure, please read this chapter before you decide. If you are an advanced developer ready to jump in and work with versions, use the node version manager. If you just want to get started exploring npm, using the Node.js installation method is fastest. You can install npm via the Node.js website, or by installing a Node Version Manager or NVM. Npm is written in Node.js, so you need to install Node.js in order to use npm. To explore additional features that you might wish to use as your project evolves, click here. To learn more about npm as a product, new features on the way, and interesting uses of npm, sign up for our newsletter at npm-weekly. We look forward to seeing what you will create! 深入学习 Now that you know what npm is, and a bit about how to use it, it's time to get started. Now, you can read the developer's instructions to discover how to use this package. This information is written by the package author(s) so details vary. When you choose a package to explore, more information appears. Or, click, to filter the possibilities even more: Rather than spend weeks figuring out how to do this, why not see if someone has posted a package that creates QR codes? Start by entering a value in the search bar: 实例:查找一个包(package)įor example, suppose you wanted to use bar codes (QR codes) in your application. (To understand the difference between node modules and packages, click here).
0 Comments
Leave a Reply. |