1,解压后,配置node环境变量
vim /etc/profile
export NODE_HOME=/opt/node-v10.15.3-linux-x64
export PATH=$PATH:$NODE_HOME/bin
是环境变量生效
$source /etc/profile
测试安装是否成功
$node -v
v10.15.3
$npm -v
6.4.1
2,安装grunt
npm install grunt-cli
npm install grunt-cli --registry=https://registry.npm.taobao.org --no-proxy
grunt --version
找不到程序,配置环境变量
export PATH=/app/elasticsearch-head-master/node_modules/grunt-cli/bin:$PATH
3,安装head
1,unzip elasticsearch-head-master.zip
cd elasticsearch-head-master
执行安装
npm install
2,修改配置文件 elasticsearch-head-master/Gruntfile.js
connect: {
server: {
options: {
port: 9100,
hostname: '*',
base: '.',
keepalive: true
}
}
}
3,elasticsearch-head-master/_site/app.js
修改前:
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
修改后:
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://172.16.X.X:9200";
4,启动
-
启动head nohup grunt server
5,遇到的问题
1) npm install时卡住不动
npm install --global smart-npm --registry=https://registry.npm.taobao.org/
2)提示:npm ERR! Error: EACCES: permission denied, access
(1)创建global安装任务的目录
mkdir ~/.npm-global
(2)配置npm使用新的目录
npm config set prefix '~/.npm-global'
(3)在~/.profile文件中增加配置
export PATH=~/.npm-global/bin:$PATH
(4)配置文件立即生效
source ~/.profile
(5)重新执行命令
npm install
3)安装grunt报错
run `npm audit fix` to fix them, or `npm audit` for details html
$npm audit fix
npm audit fix --force` to install breaking changes; or do it by hand
$npm audit fix --force
$npm audit