npm安装从github库不安装devDependencies

我试图直接从GitHub( https://github.com/ethereum/web3.js )安装ethereum / web3.js存储库,但devDependencies没有被安装(只有依赖关系)。 我已经尝试了以下内容:

npm install https://github.com/ethereum/web3.js.git npm install git+https://github.com/ethereum/web3.js.git npm install ethereum/web3.js npm install https://github.com/ethereum/web3.js.git --only=dev npm install git+https://github.com/ethereum/web3.js.git --only=dev npm install ethereum/web3.js --only=dev 

上面的前3个命令只会在web3.js的package.json文件的dependencies部分安装5个依赖项,3“–only = dev”命令不会安装任何东西。

 "dependencies": { "bignumber.js": "git+https://github.com/frozeman/bignumber.js- nolookahead.git", "crypto-js": "^3.1.4", "utf8": "^2.1.1", "xhr2": "*", "xmlhttprequest": "*" }, 

当我使用以下命令时,将安装288个软件包:

 npm install web3 

如何使用GitHub存储库链接执行相同的安装?

这是因为当您使用npm install web3 ,npm会将web3安装为应用程序的包依赖项。
您在node_module文件夹中看到的5个依赖关系是web3.js需要运行的依赖关系。

不确定有一个内置的选项可以用npm来做,但是你可以安装这个包的开发版本:

 $ npm install --save https://github.com/ethereum/web3.js.git \ && cd node_modules/web3/ \ && npm install --only=dev 

或者更传统的东西:

 $ git clone https://github.com/ethereum/web3.js.git \ && cd web3.js \ && npm install --only=dev