Challenges when deploying React applications to GitHub Pages
P粉611456309
P粉611456309 2023-08-16 15:59:12
0
1
356


PS C:UsersPanchOneDriveDesktopYourself2> npm run deploy npm ERR! Missing script: "deploy" npm ERR! npm ERR! To see a list of scripts, run: npm ERR! npm run npm ERR! The full log that can be run here is at: C:UsersPanchAppDataLocalnpm-cache_logs2023-08-15T16_47_39_705Z-debug-0.log PS C:UsersPanchOneDriveDesktopYourself2>

All possible ways

P粉611456309
P粉611456309

reply all (1)
P粉141925181

Looks like you didn't define the task inpackage.json(check it yourself). Since you are using React, make sure you have installed thegh-pagesnpm package

npm install gh-pages --save-dev

In addition, you also need to define tasks under thescriptsobject in thepackage.jsonfile:

"predeploy": "npm run build", "deploy": "gh-pages -d build",

For example, one of my github pages React applications has the following content:

"scripts": { "predeploy": "npm run build", "deploy": "gh-pages -d build", "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" },

Follow the instructions for a more detailed answer:https://github.com/gitname/react-gh-pages

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!