鍍金池/ 問(wèn)答/HTML5  HTML/ 用npm安裝模塊問(wèn)題

用npm安裝模塊問(wèn)題

有些靜態(tài)資源想用npm裝到static目錄下,請(qǐng)問(wèn)怎么指定安裝模塊的路徑

回答
編輯回答
帥到炸

node.js之npm安裝模塊的路徑

npm安裝模塊默認(rèn)為 shell 的當(dāng)前目錄。如果要裝成全局的,使用 npm install xss -g

npm help install里的描述是:

Packages are dropped into the node_modules folder under the prefix. Global installs on Unix systems go to {prefix}/lib/node_modules. Global installs on Windows go to {prefix}/node_modules (that is,no lib folder.)
1
翻譯出來(lái)大意是:

Packages 安裝進(jìn) prefix 前綴的 node_modules。Unix系統(tǒng)里 Global 安裝會(huì)裝進(jìn) {prefix}/lib/node_modules。Windows系統(tǒng)里則是 {prefix}/node_modules (就是說(shuō)沒(méi)有 lib 文件夾)。
1
通過(guò) npm config ls 可列出 prefix 的配置

修改 prefix 可以 npm config set prefix “f:\node”

2018年3月17日 01:49
編輯回答
避風(fēng)港

bower安裝吧

2017年10月9日 04:57