我有一个看起来像这样的 package.json:
{
"name": "test",
"version": "0.0.1",
"description": "test test",
"main": "index.js",
"scripts": {
"test": "echo \"No test specified\""
} ,
"devDependencies": {
"gulp": "^3.9.1"
},
"dependencies": {
"bootstrap": "^4.0.0-alpha.5"
}
}
是否可以将 Bootstrap 安装在“node_modues”之外的另一个目录中。如果是这样,如何将其写入“package.json”文件
最佳答案
您可以在package.json
中使用此代码:
{
"scripts": {
"preinstall": "npm install bootstrap --prefix ./another/"
}
}
您的模块将安装在 ./another/node_module
注意:因此您可以使用此脚本中的其他选项来根据需要安装模块。
关于node.js - 更改安装目录,npm 和 package.json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40681232/