专栏首页cwl_Java快速学习-NPM官方文档(英文版)

快速学习-NPM官方文档(英文版)

npm(1) – a JavaScript package manager

SYNOPSIS

This is just enough info to get you up and running.

Much more info will be available via npm help once it’s installed.

IMPORTANT

You need node v6 or higher to run this program.

To install an old and unsupported version of npm that works on node v5 and prior, clone the git repo and dig through the old tags and branches.

npm is configured to use npm, Inc.'s public registry at https://registry.npmjs.org by default. Use of the npm public registry is subject to terms of use available at https://www.npmjs.com/policies/terms.

You can configure npm to use any compatible registry you like, and even run your own registry. Check out the doc on registries.

Super Easy Install

npm is bundled with node.

Windows Computers

Get the MSI. npm is in it.

Apple Macintosh Computers

Get the pkg. npm is in it.

Other Sorts of Unices

Run make install. npm will be installed with node.

If you want a more fancy pants install (a different version, customized paths, etc.) then read on.

Fancy Install (Unix)

There’s a pretty robust install script at https://www.npmjs.com/install.sh. You can download that and run it.

Here’s an example using curl:

curl -L https://www.npmjs.com/install.sh | sh

Slightly Fancier

You can set any npm configuration params with that script:

npm_config_prefix=/some/path sh install.sh

Or, you can run it in uber-debuggery mode:

npm_debug=1 sh install.sh

Even Fancier

Get the code with git. Use make to build the docs and do other stuff. If you plan on hacking on npm, make link is your friend.

If you’ve got the npm source code, you can also semi-permanently set arbitrary config keys using the ./configure --key=val ..., and then run npm commands by doing node bin/npm-cli.js <command> <args>. (This is helpful for testing, or running stuff without actually installing npm itself.)

Windows Install or Upgrade

Many improvements for Windows users have been made in npm 3 - you will have a better experience if you run a recent version of npm. To upgrade, either use Microsoft’s upgrade tool, download a new version of Node, or follow the Windows upgrade instructions in the Installing/upgrading npm post.

If that’s not fancy enough for you, then you can fetch the code with git, and mess with it directly.

Installing on Cygwin

No.

Uninstalling

So sad to see you go.

sudo npm uninstall npm -g

Or, if that fails,

sudo make uninstall

More Severe Uninstalling

Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you’ve installed.

If you would like to remove all the packages that you have installed, then you can use the npm ls command to find them, and then npm rm to remove them.

To remove cruft left behind by npm 0.x, you can use the included clean-old.sh script file. You can run it conveniently like this:

npm explore npm -g -- sh scripts/clean-old.sh

npm uses two configuration files, one for per-user configs, and another for global (every-user) configs. You can view them by doing:

npm config get userconfig   # defaults to ~/.npmrc
npm config get globalconfig # defaults to /usr/local/etc/npmrc

Uninstalling npm does not remove configuration files by default. You must remove them yourself manually if you want them gone. Note that this means that future npm installs will not remember the settings that you have chosen.

More Docs

Check out the docs.

You can use the npm help command to read any of them.

If you’re a developer, and you want to use npm to publish your program, you should read this.

BUGS

When you find issues, please report them:

Be sure to include all of the output from the npm command that didn’t work as expected. The npm-debug.log file is also helpful to provide.

SEE ALSO

  • npm(1)
  • npm-help(1)

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 前端基础-Node.js包管理器npm

    上面的代码,我们使用npm安装了moment来进行格式化时间的处理,这就是使用第三方模块;

    cwl_java
  • 速读原著-TCP/IP(UDP:用户数据报协议)

    U D P是一个简单的面向数据报的运输层协议:进程的每个输出操作都正好产生一个 U D P数据报,并组装成一份待发送的 I P数据报。这与面向流字符的协议不同,...

    cwl_java
  • 快速学习-Saturn(英文版入门指引)

    Saturn is a platform created by VIP.com(唯品会) to provide a distributed, fault tol...

    cwl_java
  • 捉虫记:Unexpected end of JSON input while parsing

    npm 的源码在 https://github.com/npm/cli,找到以下 Issue

    山月
  • 【Npm原理】Npm 执行命令中的环境变量

    今天,我们来探索,npm run 到底是怎么执行命令的,模块是否一定要全局安装呢?

    神仙朱
  • Node.js 包管理器 NPM 讲解

    包管理器又称软件包管理系统,它是在电脑中自动安装、配制、卸载和升级软件包的工具组合,在各种系统软件和应用软件的安装管理中均有广泛应用。对于我们业务开发也很受益,...

    五月君
  • 你想知道的 NPM 包管理器讲解

    包管理器又称软件包管理系统,它是在电脑中自动安装、配制、卸载和升级软件包的工具组合,在各种系统软件和应用软件的安装管理中均有广泛应用。对于我们业务开发也很受益,...

    coder_koala
  • Express开发实例(1) —— Hello,world!

    Express是NodeJs开发中最常用的基础模块。NodeJs本身有Http模块,但是易用性并不好,因此有人在此基础上开发了Express模块。 什么是...

    用户1154259
  • VB-取日期属于星期几

            有时会比较常用了,很简单但我记不住。 调用: "星期" & ToCN(Weekday(date, vbMonday)) Function To...

    用户1075292
  • Springsecurity之ExceptionTranslationFilter

        Springsecurity的版本是4.3.x,源码可以在Github上下载。

    克虏伯

扫码关注云+社区

领取腾讯云代金券