1

I am trying to configure github action to auto deploy hexo project.

The yml like below:

name: Blog Auto Deploy

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Download Source file
      uses: actions/checkout@v2
      with:
        ref: main # Specify the name of the branch where you store Hexo source files
    - name: Prepare Node env
      uses: actions/setup-node@v1
      with:
        node-version: "10.x" # This corresponds to your own nodejs version (10.12 tested well)
    - name: Set Env
      env: 
        GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Replace with Github_Token 
      run: |
        git config --global user.name 'xx' # github用户名
        git config --global user.email 'xx' # github邮箱
        sed -i "s/GITHUB_ACCESS_TOKEN/$GITHUB_ACCESS_TOKEN/g" ./_config.yml
    - name: Hexo
      run:
        npm install -g hexo-cli
        npm install
        npx Hexo clean
        npx Hexo g -d

But, I got error below in github actions:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/Hexo - Not found
npm ERR! 404 
npm ERR! 404  'Hexo@latest' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because 
npm ERR! 404  1. name can no longer contain capital letters
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm timing npm Completed in 1695ms
Edward
  • 28,296
  • 11
  • 76
  • 121
  • "Your package name is not valid, because name can no longer contain capital letters" - Have you tried changing all references to lowercase? – ale917k Mar 23 '21 at 07:21
  • @ale917k I checked my project, there is no capital `Hexo` in package, I miss-use this command in the first githubaction `npm install Hexo`, but now, I already delete this line, but it still popup error with `Hexo` – Edward Mar 23 '21 at 07:27
  • Have you tried removing your node_modules and package-lock.json and reinstalling all again? – ale917k Mar 23 '21 at 07:28
  • @ale917k This error is returned by githubaction, I did not checkin the `node_modules` and `package-lock.json` – Edward Mar 23 '21 at 07:30
  • It's returned by githubactions because that's where you are trying to install the package - If I were you I'd give that a shot, because if you have the Hexo package on your lock.json still saved with capitalised letter, then it will try and install it formatted as such once running your actions. – ale917k Mar 23 '21 at 07:34
  • @ale917k please check this [screen](https://i.stack.imgur.com/C1YPz.png), there is no `node_modules` and `package-lock.json`. – Edward Mar 23 '21 at 07:39
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/230242/discussion-between-edward-and-ale917k). – Edward Mar 23 '21 at 07:42

0 Answers0