20190214初识hexo框架,以下为踩坑点
前提: 安装了node 和 git
一: 安装 hexo脚手架
会出现以下信息:
1)
1 2 3 4 5 6 7 8 9 10 11
| Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! A complete log of this run can be found in: npm ERR! /Users/nieyuling/.npm/_logs/2019-02-14T07_10_39_923Z-debug.log
|
原因: permission denied, mac电脑没有权限, 需加 sudo, 将安装命令改为
1
| $ sudo npm install hexo -g
|
2)
1 2 3 4 5 6 7 8
| Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/hexo-cli/node_modules/fsevents/build' gyp ERR! System Darwin 18.2.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/hexo-cli/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/hexo-cli/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64" "--napi_version=3" "--node_abi_napi=napi" gyp ERR! cwd /usr/local/lib/node_modules/hexo-cli/node_modules/fsevents gyp ERR! node -v v8.11.3 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok node-pre-gyp ERR! build error
|
原因: permission denied, 同样是没有权限
方案:
可用命令
1
| $ sudo chown -R $USER /usr/local
|
扩大权限,再重新执行一次
即可
二:安装成功以后
1 2
| $ hexo init <folderName>
|
1 2
| $ hexo generate $ hexo server
|