shenliyang / hexo-theme-snippet

Snippet 简洁而不简单,也许是一款你寻找已久的hexo主题
https://snippet.shenliyang.com/
MIT License
1.09k stars 210 forks source link

Travis cl自动化构建报错问题 和 底栏修改疑问 #139

Closed Syngnath closed 5 years ago

Syngnath commented 5 years ago

自动化构建报错问题

一切都是按教程做,但是Travis Cl自动化构建时到 - gulp 时报了错,下面贴下报错日志 重点段落:

$ node --version
v12.3.1
$ npm --version
6.9.0
$ nvm --version
0.34.0

$ gulp default
fs.js:27
const { Math, Object } = primordials;

ReferenceError: primordials is not defined
    at fs.js:27:26
    at req_ (/home/travis/build/Syngnath/Syngnath.github.io/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/home/travis/build/Syngnath/Syngnath.github.io/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/home/travis/build/Syngnath/Syngnath.github.io/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
The command "gulp default" exited with 1.

现在我的package.json文件

{
  "name": "hexo-theme-snippet",
  "version": "1.2.3",
  "description": "Snippet 简洁而不简单,也许是一款你寻找已久的hexo主题",
  "author": "shenliyang",
  "license": "MIT",
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/shenliyang/hexo-theme-snippet.git"
  },
  "bugs": {
    "url": "https://github.com/shenliyang/hexo-theme-snippet/issues"
  },
  "homepage": "https://shenliyang.github.io",
  "hexo": {
    "version": "3.8.0"
  },
  "dependencies": {
    "ejs": "^2.6.1",
    "hexo": "^3.3.8",
    "hexo-abbrlink": "^2.0.4",
    "hexo-deployer-git": "^1.0.0",
    "hexo-generator-archive": "^0.1.4",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-feed": "^1.2.0",
    "hexo-generator-index": "^0.2.0",
    "hexo-generator-json-content": "^4.1.3",
    "hexo-generator-baidu-sitemap": "^0.1.6",
    "hexo-generator-sitemap": "^1.2.0",
    "hexo-generator-tag": "^0.2.0",
    "hexo-renderer-ejs": "^0.3.1",
    "hexo-renderer-marked": "^0.3.2",
    "hexo-server": "^0.3.3"
  },
  "devDependencies": {
    "gulp": "^3.9.0",
    "gulp-autoprefixer": "^6.0.0",
    "gulp-htmlclean": "^2.7.15",
    "gulp-htmlmin": "^5.0.1",
    "gulp-jshint": "^2.0.4",
    "gulp-less": "^4.0.1",
    "gulp-minify-css": "^1.2.4",
    "gulp-notify": "^3.0.0",
    "gulp-path": "^4.0.0",
    "gulp-plumber": "^1.1.0",
    "gulp-rename": "^1.2.2",
    "gulp-rev-append": "^0.1.8",
    "gulp-sequence": "^1.0.0",
    "gulp-uglify": "^3.0.2",
    "gulp-watch": "^5.0.1",
    "jshint": "^2.9.5",
    "jshint-stylish": "^2.2.1"
  }
}


没加任何插件 另外google过好像也有人有类似的错误 猜测可能是gulp版本导致的?不太清楚,希望hub主能够帮我解决这个问题

后续: 发现本地gulp没有出错,怀疑是node版本号导致,因为默认是stable(稳定版),这样会导致travis cl用最新版的稳定版,所以一些api升级后就出错了。现在电脑本地是10.x没有问题,travis的stable默认是12.x 所以将stable改为10.15.3后显示构建成功。 但是接着又发现以下显示的错误

尝试在 .travis.yml 中添加一条安装notify的语句在npm install gulp后面,

before_script:
  - export TZ='Asia/Shanghai'
  - npm install -g gulp
  - npm install --save-dev gulp-notify
  - chmod +x _travis.sh

看看输出些什么 最后还是报错找不到notify-send,情况没有任何改变

1h later 发现notify默认这条语句安装的是最新的3.2.0版本,而主题用的是3.0.0版本 于是改了下,如下

before_script:
  - export TZ='Asia/Shanghai'
  - npm install --save-dev gulp-notify@3.0.0
  - npm install -g gulp
  - chmod +x _travis.sh

自动构建不报错绿灯通过,问题也许算是解决了,不知道notify和部署有什么关系(如果有关系希望解答下) 虽然问题依旧,但是起码构建不报错

底栏修改

另外我想问问最下面栏的power by hexo 和 Theme By Snippet怎样修改?

shenliyang commented 5 years ago

问题已修复,请拉取最新代码。

garygchai commented 4 years ago

问题已修复,请拉取最新代码。

还没有解决? 我也遇到了同样的问题:

fs.js:27
const { Math, Object, Reflect } = primordials;
                                  ^

ReferenceError: primordials is not defined
    at fs.js:27:35
    at req_ (/Users/changhai.gch/garygchai.github.io/hexo-new/themes/hexo-theme-snippet/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/Users/changhai.gch/garygchai.github.io/hexo-new/themes/hexo-theme-snippet/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/Users/changhai.gch/garygchai.github.io/hexo-new/themes/hexo-theme-snippet/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hexo-theme-snippet@1.2.3 build: `gulp default`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hexo-theme-snippet@1.2.3 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

node version: v12.1.0 macOS 10.16.4

shenliyang commented 4 years ago

node请使用10.x的稳定版本