Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.8k views
in Technique[技术] by (71.8m points)

github - Npm run deploy script for gh-pages

This is probably something super simple, but for the life of me, I can't manage to figure out what is wrong.

I have created a script in my package.json to deploy a simple page to Github pages, but npm is not finding the command. . .

package.json

{
    "name": "my-css-cv",
    "version": "1.0.0",
    "description": "My css cv",
    "main": "index.js",
    "scripts": {
        "deploy": "gh-pages -d dist"
    },
    "repository": {
        "type": "git",
        "url": "git+https://github.com/fridavbg/my-css-cv.git"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "bugs": {
        "url": "https://github.com/fridavbg/my-css-cv/issues"
    },
    "homepage": "https://github.com/fridavbg/my-css-cv",
    "dependencies": {
        "gh-pages": "^3.1.0"
    }
}

ERROR from npm:

sh: gh-pages: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! my-css-cv@1.0.0 deploy: `gh-pages -d dist`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the my-css-cv@1.0.0 deploy 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: npm ERR! /Users/fridavbg/.npm/_logs/2021-01-12T17_54_20_354Z-debug.log

I have tried deleting my package.json & node_modules but get the same error after setting it up again. Also if I do just npm run cmd line shows me:

Scripts available in my-CSS-cv via `npm run-script`:
  deploy
    gh-pages -d dist

Github repo is all set up and I have no issues committing. If anyone has some advice about why this is not working.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...