国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

npm官方npm-install文檔翻譯

RobinQu / 980人閱讀

摘要:如果版本尚未發布到注冊表,則會失敗。參數將阻止安裝可選的依賴項。參數,它將忽略可用的包鎖或文件,而是使用。參數可用于禁止將審計報告發送到已配置的注冊表。

我覺得所有程序員都在努力的學習閱讀英語吧,畢竟英語閱讀沒問題,我們才能更好的閱讀文檔,為了給大家更快的學習效率,所以翻譯了這一篇中英文對照的文章。如果你每次安裝package包時候會想,what?各種命令--save  -D 之類的究竟是什么鬼?那么可以接著往下看了。
npm-install

Install a package 安裝一個包

SYNOPSIS 簡介

npm install (with no args, in package dir)
npm install [<@scope>/]
npm install [<@scope>/]@
npm install [<@scope>/]@
npm install [<@scope>/]@
npm install :/
npm install 
npm install 
npm install 
npm install 

aliases: npm i, npm add
別名:npm i, npm add

common options: [-P|--save-prod|-D|--save-dev|-O|--save-optional] [-E|--save-exact] [-B|--save-bundle] [--no-save] [--dry-run]

DESCRIPTION 描述
This command installs a package, and any packages that it depends on. If the package has a package-lock or shrinkwrap file, the installation of dependencies will be driven by that, with an npm-shrinkwrap.json taking precedence if both files exist. See package-lock.json and npm-shrinkwrap.
此命令將安裝程序包及其依賴的任何程序包。 如果軟件包具有package-lock或shrinkwrap文件,則依賴項的安裝將由此驅動,如果兩個文件都存在,則npm-shrinkwrap.json優先。 請參閱package-lock.json和npm-shrinkwrap。

A package is:

a) a folder containing a program described by a package.json file
b) a gzipped tarball containing (a)
c) a url that resolves to (b)
d) a @ that is published on the registry (see npm-registry) with (c)
e) a @ (see npm-dist-tag) that points to (d)
f) a that has a “latest” tag satisfying (e)
g) a that resolves to (a)

包裹是:

a)包含package.json文件描述的程序的文件夾
b)包含(a)的壓縮的tarball
c)解析為(b)的網址
d)在注冊表上發布的 @ (參見npm-registry)(c)
e)指向(d)的 @ (參見npm-dist-tag)
f)具有滿足(e)的“最新”標簽的
g)解析為(a)的

Even if you never publish your package, you can still get a lot of benefits of using npm if you just want to write a node program (a), and perhaps if you also want to be able to easily install it elsewhere after packing it up into a tarball (b).
即使您從未發布過您的軟件包,如果您只想編寫一個節點程序(a),或者如果您還希望能夠在打包之后輕松地將其安裝在其他地方,那么使用npm仍然可以獲得很多好處。 進入tarball(b)。

npm install (in package directory, no arguments):

npm install(在包目錄中,沒有參數):

Install the dependencies in the local node_modules folder.
在本地node_modules文件夾中安裝依賴項。

In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.
在全局模式下(即,在命令后附加-g或--global),它將當前包上下文(即當前工作目錄)安裝為全局包。

By default, npm install will install all modules listed as dependencies in package.json.
默認情況下,npm install將在package.json中安裝列為依賴項的所有模塊。

With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.
使用--production標志(或當NODE_ENV環境變量設置為production時),npm將不會安裝devDependencies中列出的模塊。

NOTE: The --production flag has no particular meaning when adding a dependency to a project.
注意:向項目添加依賴項時, - production標志沒有特別的意義。

npm install :

npm install 文件夾

Install the package in the directory as a symlink in the current project. Its dependencies will be installed before it’s linked. If sits inside the root of your project, its dependencies may be hoisted to the toplevel node_modules as they would for other types of dependencies.
將包作為當前項目中的符號鏈接安裝在目錄中。 它的依賴項將在鏈接之前安裝。 如果位于項目的根目錄內,則其依賴關系可能會升級到頂層node_modules,就像它們對其他類型的依賴項一樣。

npm install :

Install a package that is sitting on the filesystem. Note: if you just want to link a dev directory into your npm root, you can do this more easily by using npm link.
安裝位于文件系統上的軟件包。 注意:如果您只想將dev目錄鏈接到npm根目錄,則可以使用npm link更輕松地完成此操作。

Tarball requirements:

The filename must use .tar, .tar.gz, or .tgz as the extension.
The package contents should reside in a subfolder inside the tarball (usually it is called package/). npm strips one directory layer when installing the package (an equivalent of tar x --strip-components=1 is run).
The package must contain a package.json file with name and version properties.
文件名必須使用.tar,.tar.gz或.tgz作為擴展名。
包內容應該駐留在tarball內的子文件夾中(通常稱為package /)。 npm在安裝軟件包時剝離一個目錄層(運行相當于tar x --strip-components = 1)。
該包必須包含具有名稱和版本屬性的package.json文件。
Example:

npm install ./package.tgz

npm install :

Fetch the tarball url, and then install it. In order to distinguish between this and other options, the argument must start with “http://” or “https://”
獲取tarball URL,然后安裝它。 為了區分這個和其他選項,參數必須以“http://”或“https://”開頭。

Example:

npm install https://github.com/indexzero/forever/tarball/v0.5.6

npm install [<@scope>/]:

Do a @ install, where is the “tag” config. (See npm-config. The config’s default value is latest.)

In most cases, this will install the version of the modules tagged as latest on the npm registry.
在大多數情況下,這將在npm注冊表中安裝標記為最新的模塊版本。

Example:

npm install sax

npm install saves any specified packages into dependencies by default. Additionally, you can control where and how they get saved with some additional flags:
npm install默認將任何指定的包保存到依賴項中。 此外,您可以通過一些額外的標志來控制保存的位置和方式:

-P, --save-prod: Package will appear in your dependencies. This is the default unless -D or -O are present.
包將出現在您的依賴項中。 除非存在-D或-O,否則這是默認值。

-D, --save-dev: Package will appear in your devDependencies.
包將出現在您的devDependencies中。

-O, --save-optional: Package will appear in your optionalDependencies.
包將出現在您的optionalDependencies中。

--no-save: Prevents saving to dependencies.
防止保存到依賴項。

When using any of the above options to save dependencies to your package.json, there are two additional, optional flags:
當使用上述任何選項來保存對package.json的依賴關系時,還有兩個額外的可選標志:

-E, --save-exact: Saved dependencies will be configured with an exact version rather than using npm’s default semver range operator.
保存的依賴項將使用精確版本配置,而不是使用npm的默認semver范圍運算符。

-B, --save-bundle: Saved dependencies will also be added to your bundleDependencies list.
保存的依賴項也將添加到您的bundleDependencies列表中。

Further, if you have an npm-shrinkwrap.json or package-lock.json then it will be updated as well.
此外,如果你有一個npm-shrinkwrap.json或package-lock.json,那么它也會被更新。

is optional. The package will be downloaded from the registry associated with the specified scope. If no registry is associated with the given scope the default registry is assumed. See npm-scope.
是可選的。 該包將從與指定范圍關聯的注冊表中下載。 如果沒有與給定范圍關聯的注冊表,則假定使用默認注冊表。 請參閱npm-scope。

Note: if you do not include the @-symbol on your scope name, npm will interpret this as a GitHub repository instead, see below. Scopes names must also be followed by a slash.
注意:如果您沒有在范圍名稱中包含@ -symbol,則npm會將其解釋為GitHub存儲庫,請參閱下文。 范圍名稱后面還必須有斜杠。

Examples:

npm install sax
npm install githubname/reponame
npm install @myorg/privatepackage
npm install node-tap --save-dev
npm install dtrace-provider --save-optional
npm install readable-stream --save-exact
npm install ansi-regex --save-bundle

Note: If there is a file or folder named in the current working directory, then it will try to install that, and only try to fetch the package by name if it is not valid.
注意:如果當前工作目錄中存在名為的文件或文件夾,則它將嘗試安裝該文件或文件夾,并且只有在無效時才嘗試按名稱獲取程序包。

npm install [<@scope>/]@:

Install the version of the package that is referenced by the specified tag. If the tag does not exist in the registry data for that package, then this will fail.
安裝指定標記引用的包的版本。 如果該包的注冊表數據中不存在該標記,則此操作將失敗。

Example:

npm install sax@latest
npm install @myorg/mypackage@latest

npm install [<@scope>/]@:

Install the specified version of the package. This will fail if the version has not been published to the registry.
安裝指定版本的軟件包。 如果版本尚未發布到注冊表,則會失敗。

Example:

npm install sax@0.1.1
npm install @myorg/privatepackage@1.5.0

npm install [<@scope>/]@:

Install a version of the package matching the specified version range. This will follow the same rules for resolving dependencies described in package.json.
安裝與指定版本范圍匹配的軟件包版本。 這將遵循解決package.json中描述的依賴關系的相同規則。

Note that most version ranges must be put in quotes so that your shell will treat it as a single argument.
請注意,大多數版本范圍必須放在引號中,以便shell將其視為單個參數。

Example:

npm install sax@">=0.1.0 <0.2.0"
npm install @myorg/privatepackage@">=0.1.0 <0.2.0"

npm install :

Installs the package from the hosted git provider, cloning it with git. For a full git remote url, only that URL will be attempted.
從托管的git提供程序安裝包,使用git克隆它。 對于完整的git遠程URL,只會嘗試該URL。

://[[:]@][:][:][/][# | #semver:]

is one of git, git+ssh, git+http, git+https, or git+file.

If # is provided, it will be used to clone exactly that commit. If the commit-ish has the format #semver:, can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither # or #semver: is specified, then the default branch of the repository is used.
如果提供了#,它將用于完全克隆該提交。 如果commit-ish的格式為#semver:,則可以是任何有效的semver范圍或精確版本,npm將查找遠程存儲庫中與該范圍匹配的任何標記或引用,就像它可以 注冊表依賴項。 如果既未指定#或#semver:,則使用存儲庫的默認分支。

If the repository makes use of submodules, those submodules will be cloned as well.
如果存儲庫使用子模塊,那么也將克隆這些子模塊。

If the package being installed contains a prepare script, its dependencies and devDependencies will be installed, and the prepare script will be run, before the package is packaged and installed.
如果正在安裝的軟件包包含一個prepare腳本,則將安裝其依賴項和devDependencies,并在打包和安裝軟件包之前運行prepare腳本。

The following git environment variables are recognized by npm and will be added to the environment when running git:
以下git環境變量由npm識別,并在運行git時添加到環境中:

GIT_ASKPASS
GIT_EXEC_PATH
GIT_PROXY_COMMAND
GIT_SSH
GIT_SSH_COMMAND
GIT_SSL_CAINFO
GIT_SSL_NO_VERIFY
See the git man page for details.

Examples:

npm install git+ssh://git@github.com:npm/cli.git#v1.0.27
npm install git+ssh://git@github.com:npm/cli#semver:^5.0
npm install git+https://isaacs@github.com/npm/cli.git
npm install git://github.com/npm/cli.git#v1.0.27
GIT_SSH_COMMAND="ssh -i ~/.ssh/custom_ident" npm install git+ssh://git@github.com:npm/cli.git

npm install /[#]:
npm install github:/[#]:

Install the package at https://github.com/githubname... by attempting to clone it using git.
通過嘗試使用git克隆它,在https://github.com/githubname...。

If # is provided, it will be used to clone exactly that commit. If the commit-ish has the format #semver:, can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither # or #semver: is specified, then master is used.
如果提供了#,它將用于完全克隆該提交。 如果commit-ish的格式為#semver:,則可以是任何有效的semver范圍或精確版本,npm將查找遠程存儲庫中與該范圍匹配的任何標記或引用,就像它可以 注冊表依賴項。 如果既未指定#或#semver:,則使用master。

As with regular git dependencies, dependencies and devDependencies will be installed if the package has a prepare script, before the package is done installing.
與常規git依賴項一樣,如果程序包具有prepare腳本,則在安裝程序包之前將安裝依賴項和devDependencies。

Examples:

npm install mygithubuser/myproject
npm install github:mygithubuser/myproject

npm install gist:[/][#|#semver:]:

Install the package at https://gist.github.com/gistID by attempting to clone it using git. The GitHub username associated with the gist is optional and will not be saved in package.json.
通過嘗試使用git克隆它,在https://gist.github.com/gistI...。 與gist關聯的GitHub用戶名是可選的,不會保存在package.json中。

As with regular git dependencies, dependencies and devDependencies will be installed if the package has a prepare script, before the package is done installing.
與常規git依賴項一樣,如果程序包具有prepare腳本,則在安裝程序包之前將安裝依賴項和devDependencies。

Example:

npm install gist:101a11beef

npm install bitbucket:/[#]:

Install the package at https://bitbucket.org/bitbuck... by attempting to clone it using git.
通過嘗試使用git克隆它,在https://bitbucket.org/bitbuck...。

If # is provided, it will be used to clone exactly that commit. If the commit-ish has the format #semver:, can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither # or #semver: is specified, then master is used.
如果提供了#,它將用于完全克隆該提交。 如果commit-ish的格式為#semver:,則可以是任何有效的semver范圍或精確版本,npm將查找遠程存儲庫中與該范圍匹配的任何標記或引用,就像它可以 注冊表依賴項。 如果既未指定#或#semver:,則使用master。

As with regular git dependencies, dependencies and devDependencies will be installed if the package has a prepare script, before the package is done installing.
與常規git依賴項一樣,如果程序包具有prepare腳本,則在安裝程序包之前將安裝依賴項和devDependencies。

Example:

npm install bitbucket:mybitbucketuser/myproject

npm install gitlab:/[#]:

Install the package at https://gitlab.com/gitlabname... by attempting to clone it using git.
通過嘗試使用git克隆它,在https://gitlab.com/gitlabname...。

If # is provided, it will be used to clone exactly that commit. If the commit-ish has the format #semver:, can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither # or #semver: is specified, then master is used.
如果提供了#,它將用于完全克隆該提交。 如果commit-ish的格式為#semver:,則可以是任何有效的semver范圍或精確版本,npm將查找遠程存儲庫中與該范圍匹配的任何標記或引用,就像它可以 注冊表依賴項。 如果既未指定#或#semver:,則使用master。

As with regular git dependencies, dependencies and devDependencies will be installed if the package has a prepare script, before the package is done installing.
與常規git依賴項一樣,如果程序包具有prepare腳本,則在安裝程序包之前將安裝依賴項和devDependencies。

Example:

npm install gitlab:mygitlabuser/myproject
npm install gitlab:myusr/myproj#semver:^5.0

You may combine multiple arguments, and even multiple types of arguments. For example:
您可以組合多個參數,甚至多種類型的參數。 例如:

npm install sax@">=0.1.0 <0.2.0" bench supervisor
The --tag argument will apply to all of the specified install targets. If a tag with the given name exists, the tagged version is preferred over newer versions.
--tag參數將應用于所有指定的安裝目標。 如果存在具有給定名稱的標記,則標記版本優先于較新版本。

The --dry-run argument will report in the usual way what the install would have done without actually installing anything.
--dry-run參數將以通常的方式報告安裝將在沒有實際安裝任何內容的情況下完成的操作。

The --package-lock-only argument will only update the package-lock.json, instead of checking node_modules and downloading dependencies.
--package-lock-only參數只會更新package-lock.json,而不是檢查node_modules和下載依賴項

The -f or --force argument will force npm to fetch remote resources even if a local copy exists on disk.
即使磁盤上存在本地副本,-f或--force參數也會強制npm獲取遠程資源。

npm install sax --force
The -g or --global argument will cause npm to install the package globally rather than locally. See npm-folders.
-g或--global參數將導致npm全局安裝包而不是本地安裝包。 請參閱npm-folders。

The --global-style argument will cause npm to install the package into your local node_modules folder with the same layout it uses with the global node_modules folder. Only your direct dependencies will show in node_modules and everything they depend on will be flattened in their node_modules folders. This obviously will eliminate some deduping.
--global-style參數將導致npm將包安裝到本地node_modules文件夾中,其文件布局與全局node_modules文件夾使用的布局相同。 只有您的直接依賴項將顯示在node_modules中,它們所依賴的所有內容將在其node_modules文件夾中展平。 這顯然會消除一些重復數據刪除。

The --ignore-scripts argument will cause npm to not execute any scripts defined in the package.json. See npm-scripts.
--ignore-scripts參數將導致npm不執行package.json中定義的任何腳本。 請參閱npm-scripts。

The --legacy-bundling argument will cause npm to install the package such that versions of npm prior to 1.4, such as the one included with node 0.8, can install the package. This eliminates all automatic deduping.
--legacy-bundling參數將導致npm安裝包,使得1.4之前的npm版本(例如節點0.8中包含的版本)可以安裝包。 這消除了所有自動扣除。

The --link argument will cause npm to link global installs into the local space in some cases.
在某些情況下, - link參數將導致npm將全局安裝鏈接到本地空間。

The --no-bin-links argument will prevent npm from creating symlinks for any binaries the package might contain.
--no-bin-links參數將阻止npm為包可能包含的任何二進制文件創建符號鏈接。

The --no-optional argument will prevent optional dependencies from being installed.
--no-optional參數將阻止安裝可選的依賴項。

The --no-shrinkwrap argument, which will ignore an available package lock or shrinkwrap file and use the package.json instead.
--no-shrinkwrap參數,它將忽略可用的包鎖或shrinkwrap文件,而是使用package.json。

The --no-package-lock argument will prevent npm from creating a package-lock.json file. When running with package-lock’s disabled npm will not automatically prune your node modules when installing.
--no-package-lock參數將阻止npm創建package-lock.json文件。 在使用package-lock運行時,npm在安裝時不會自動修剪節點模塊。

The --nodedir=/path/to/node/source argument will allow npm to find the node source code so that npm can compile native modules.
--nodedir = / path / to / node / source參數將允許npm查找節點源代碼,以便npm可以編譯本機模塊。

The --only={prod[uction]|dev[elopment]} argument will cause either only devDependencies or only non-devDependencies to be installed regardless of the NODE_ENV.
--only = {prod [uction] | dev [elopment]}參數將導致僅安裝devDependencies或僅安裝非devDependencies,而不管NODE_ENV如何。

The --no-audit argument can be used to disable sending of audit reports to the configured registries. See npm-audit for details on what is sent.
--no-audit參數可用于禁止將審計報告發送到已配置的注冊表。 有關發送內容的詳細信息,請參閱npm-audit。

See npm-config. Many of the configuration params have some effect on installation, since that’s most of what npm does.
請參閱npm-config。 許多配置參數對安裝有一些影響,因為這是npm的大部分內容。

本文首發于公眾號“前端的極致實現”。歡迎小可愛們來交流~加我微信(wangyuedewechat2)拉大家進群

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/106324.html

相關文章

  • 代碼組織和部署 文件操作 node.js

    代碼組織和部署 模塊的路徑解析規則 require支持/或者盤符的絕對路徑,也支持./開頭的相對地址同時require也支持第三種寫法 內置模塊 如果傳遞給require的函數是node.js的內置模塊,將會不做路徑解析,直接返回內部exports模塊要導出的對象 node_modules目錄 node.js定義一個node_modules存放模塊,每次使用foo/bar的方式的時候,會先尋找該目...

    Cc_2011 評論0 收藏0
  • React項目實戰:環境搭建

    摘要:官方文檔中文翻譯構建用戶界面的庫。官方文檔建議學習時以官方文檔為準,中文翻譯或者第三方作者的教程可以幫助你理清思路會用到的重要知識點我也會進行簡明的解釋,如遇到錯誤或者不理解的內容,歡迎實時指出。 前言 前面提到前端大統一的概念,如果感興趣,歡迎說說自己的看法,點擊前往。Web前端框架層出不窮,不可能面面俱到,這里給個小建議: 如果對Weex App感興趣,應該選擇vue框架; 如果...

    cnio 評論0 收藏0
  • React項目實戰:環境搭建

    摘要:官方文檔中文翻譯構建用戶界面的庫。官方文檔建議學習時以官方文檔為準,中文翻譯或者第三方作者的教程可以幫助你理清思路會用到的重要知識點我也會進行簡明的解釋,如遇到錯誤或者不理解的內容,歡迎實時指出。 前言 前面提到前端大統一的概念,如果感興趣,歡迎說說自己的看法,點擊前往。Web前端框架層出不窮,不可能面面俱到,這里給個小建議: 如果對Weex App感興趣,應該選擇vue框架; 如果...

    GHOST_349178 評論0 收藏0
  • Linux下node-sass安裝失敗的解決方法與簡單使用

    摘要:此后,全局安裝的模塊都會安裝在這個子目錄中,也會到目錄去尋找命令。最后,將這個路徑在文件或文件中加入變量。 記錄一下安裝node-sass的過程.關于CSS是不是一門編程語言,這里不討論,但是它沒有變量 語句 函數(反正我覺得他不是編程語言).于是程序員們發明了CSS預處理器(css preprocessor),它是一種專門的編程語言,可以使用你會的基本的編程知識進行編程,然后再轉化成...

    syoya 評論0 收藏0

發表評論

0條評論

RobinQu

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<