Npm run deploy выдает ошибку

After npm run deploy i have errors like above
Repo on Github

I am trying to deploy my react-app on gh-pages on Github (create-react-app)

'gh-pages' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello-world-4@0.1.0 deploy: `npm run build&&gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello-world-4@0.1.0 deploy script 'npm run build&&gh-page
s -d build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hello-world-4 package
,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build&&gh-pages -d build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs hello-world-4
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls hello-world-4
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersjanAppDataRoamingnpm-cache_logs2017-05-12T17_55_00_56
9Z-debug.log

asked May 12, 2017 at 18:06

Lukas's user avatar

2

please install gh-pages and it ready to go

To install

npm install gh-pages

to deploy

add this to package.json

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

and then this

npm run deploy

Kaustubh Kulkarni's user avatar

answered Dec 31, 2020 at 13:15

Vivekchauhan's user avatar

gh pages stands for GitHub Pages. It is simply a way to deploy a website via a github repo. Basically, NPM is yelling because when it attempts to run the command deploy, there is not link or reference to the line

$npm run build&&gh-pages -d build

You need make sure that gh-pages -d build is defined. A place to start would be running gh-pages --man or gh-pages --help

Brad Parks's user avatar

Brad Parks

66k64 gold badges256 silver badges332 bronze badges

answered May 12, 2017 at 18:18

Daniel Dwyer's user avatar

I facing the same problem I do the following command before
git push
not working. After

git push

I do the same command it works correctly.

npm install gh-pages

and deploy

npm run deploy

answered Sep 7, 2022 at 5:19

Mazharul Hasan's user avatar

unfortunately I cannot deploy on GitHub my Color-recognition App in React JS on GitHub pages. I am using Webpack as bundler.

My system configuration is: 
Webpack
Environment:
OS: Windows 10
Node: 8.12.0
Yarn: Not Found
npm: 6.4.1
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.5.2 => 16.5.2
react-dom: ^16.5.2 => 16.5.2
react-scripts: 1.1.5 => 1.1.5

I use extra added dependencies of Clarifai and Gsap and used the following steps:

  1. I created on my Github account the repository Color-recognition without md file, and within added gh-pages branch, and in setting of repository under Source added gh-pages branch.

  2. git add .

  3. git commit -m «Uploading files»

  4. git push -f origin master:gh-pages

  5. git remote add origin
    https://github.com/Geeeva/Color-recognition.git npm run deploy

The page should be deployed but it couldn’t, with the error below. I wanted to put the project demo that is visible.
Tried the same procedure with the master branch of the Color-recognition, and I got the same error.

The error is following:

Cannot read property 'email' of null
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! color-recognition-depl@0.1.0 deploy: gh-pages -d build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the color-recognition-depl@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersIvanaAppDataRoamingnpm-cache_logs2018-09-19T19_58_34_ 829Z-debug.log

Link to my Github repo is: https://github.com/Geeeva/Color-recognition

Hello! So, the way npm run deploy works is that it looks in your current package.json for a defined "deploy" script, and then runs that. The error message you’re seeing is trying to tell you that you have not defined a "deploy" script in your package.json, hence npm run deply has no idea what you want it to do.

To solve this issue, all you have to do is add a new script to your package.json. It might look something like this, for example:

{
  "name": "package-name",
  "version": "1.0.0",
  "description": "package description",
  "scripts": {
    "deploy": "node --version",
    "test": "echo "Error: no test specified" && exit 1"
  },
  "dependencies": {},
  "devDependencies": {}
}

Note how this package.json has a "deploy" script that runs node --version. You’ll definitely want to change the command to whatever is most appropriate for your project.

Let me know if you run into any further npm issues :)

Когда делал тестовое пришла информация, что нужно закинуть сайт на хост github pages. Уже имелся репозиторий с почти готовым проектом. При загрузке установил библиотеку npm install gh-pages --save-dev , добавил в package.json в корне файла

"homepage": "https://Roman214-go.github.io/Coincap"

и в scripts

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

Запустил через npm run deploy и в итоге пишет:
error: cannot spawn sh: No such file or directory
fatal: unable to fork
Долго мучался и искал решение проблемы, максимум что выходило — это запускался README.md на хосте.
Надеюсь понятно описал проблему и найду тут помощь.


  • Вопрос задан

    02 авг. 2022

  • 619 просмотров

Пригласить эксперта

Из-за чего может возникать ошибка

Скорее всего возникает при git clone. Если npm run deploy выполняется локально, то может проблема связана с доступом. Надо проверить, что папка, в которой выполняется команда, является репой и подключена корректно к GitHub — есть скрытая папка .git и после выполнения git remote -v есть remote с пометкой origin.

Другой вариант использовать параметр -repo:
gh-pages -d build -r <repo_url>

Также remote origin можно сбросить на всякий случай выполнив эти команды в папке репы:

$ git remote remove origin
$ git remote add origin https://github.com/Roman214-go/Coincap.git
$ git push -u origin master

А если кратко, то если все делать по этой инструкция от create-react-app — все должно заработать.

Что сейчас надо поправить и проверить на GitHub согласно инструкции

  • Надо выбрать одну из веток (master или main) для изменений. Или смержить их и избавиться от одной(лучше от main). При мерже надо быть внимательным — в main ветке в packages.json продублированы команды predeploy и deploy
  • gh-pages надо устанавливать через npm install —save gh-pages, т.е. не как devDependencies. Можно перенести из devDependencies в dependencies в packages.json и выполнить npm install
  • в скриптах изменить «deploy»: «gh-pages -d build», — убрать » -b main», таким образом будет результат выполнения скрипта будет в ветке gh-pages
  • Выполнить npm run deploy и проверить, что ветка появилась на GitHub
  • В настройках проекта установить GitHub Pages на ветку gh-pages и в качестве папка в которую build сложился

Допы:
Как найти настройки проекта GitHub Pages для настр…


  • Показать ещё
    Загружается…

22 июн. 2023, в 00:59

8000 руб./за проект

22 июн. 2023, в 00:56

8000 руб./за проект

22 июн. 2023, в 00:39

12000 руб./за проект

Минуточку внимания

Answer by Conner Choi

@bielas You should probably use Angular CLI for this. It is effective and gives more «readable» errors.

– Smit
Jul 30 ’17 at 9:23

,

It’s saying it’s failing on the npm run deploy call. You should run that yourself and see what that error looks like.

– Matt
Jul 30 ’17 at 9:19

,UPDATE:
After running npm run deploy I have:


Answer by Karsyn Watson

Deploying your newly created React App typically falls at the hands of whoever is creating the tutorial or example application that you are following. Sometimes this works out fine because they typically have experience with that deployment option, or the deployment option is easy to follow.,Firebase has many of the same options when deploying a React app as AWS and Azure. With Firebase, we can set up a statically hosted application that makes API calls to a cloud function that renders dynamic content on our site.,There are many tutorials available for deploying React applications that do not include the use of third-party API keys. Consequently, one of the most important aspects of any application (security) can have an effect on how the application is designed.

const fetchWeather = (e) => {
  e.preventDefault()
  setLoading(true)
  setError(false)

  const myInit = {
    body: {
      location
    },
  };

  //make edit to redeploy
  API.post('weatherAPI', '/weather', myInit)
    .then((data) => {
      setTempC(data.tempC)
      setTempF(data.tempF)
      setConditions(data.conditions)
    })
    .catch(e => {
      setError(true)
      console.log(e)
    })
    .finally(() => {
      setLoading(false)
    })
}

Answer by Aurora Booth

In most cases bumping the react-scripts version in package.json and running npm install in this folder should be enough, but it’s good to consult the changelog for potential breaking changes.,Then in package.json, add the following lines to scripts:,Add the following to the scripts section in your project’s package.json

my-app/
  README.md
  node_modules/
  package.json
  public/
    index.html
    favicon.ico
  src/
    App.css
    App.js
    App.test.js
    index.css
    index.js
    logo.svg

Answer by Kaylie Garcia

From implementing favicon to deploying to a cloud platform, I will share everything I learned. I’ll also share extensive code snippets, best practices, lessons, guides, and key resources.,And second, I wanted to make something of myself, having spent my teenage years inspired by Web 2.0 (Digg.com circa 2005 opened the world for me!). The plan was to work on the latter while working in the former.,These were the places I went scrounging for code samples:

Use ‘copy-webpack-plugin’ to copy all your favicon assets generated from Step-1, from the folder where you store them (in my case, src/assets/favicon) to Webpack’s output’s path (default behaviour), so that they will be accessible from the root (i.e. https://example.com/favicon.ico).

// webpack.config.js
const CopyWebpackPlugin = require("copy-webpack-plugin");

plugins: [new CopyWebpackPlugin([{ from: "src/assets/favicon" }])];

Answer by Azrael Riley

Maybe, this is system dependent as well. Thanks for the blog though.,In your project root folder create the following files with the corresponding content, and adjust the blue parts according to your situation:,I added some new contents in xml or change the title in a Panel, still the changes are NOT getting reflected on live serve

Dist
node_modules
download
.DS_Store
{
  "name": "<Your App Name>",
  "version": "<Your App Version e.g. 1.0.0>",
  "description": "UI5 application to show-case the static serve middleware for offline development",
  "private": true,
  "sslcert": "<SSL Root certificate path if needed>",
  "scripts": {
    "prepare": "mkdirp dist",
    "build": "ui5 build --clean-dest",
    "start": "cross-env NODE_EXTRA_CA_CERTS=$npm_package_sslcert ui5 serve --config ui5-dist.yaml --port 1081 --open index.html",
    "dev": "cross-env NODE_EXTRA_CA_CERTS=$npm_package_sslcert ui5 serve --port 1081 --open index.html",
    "debug": "node --inspect node_modules/.bin/ui5 serve --port 1081",
    "watch:build": "npm-watch build",
    "watch": "npm-run-all prepare --parallel watch:build start",
    "upload": "cross-env NODE_EXTRA_CA_CERTS=$npm_package_sslcert ui5 build --config ui5-dist.yaml --exclude-task * --include-task ui5-task-nwabap-deployer",
    "deploy": "npm-run-all build upload"
  },
  "watch": {
    "build": {
      "patterns": [
        "webapp"
      ],
      "extensions": "html,js,json,xml,properties",
      "quiet": false
    }
  },
  "devDependencies": {
    "@ui5/cli": "^1.10.0",
    "cross-env": "^6.0.3",
    "mkdirp": "~0.5.1",
    "npm-run-all": "^4.1.5",
    "npm-watch": "^0.6.0",
    "ui5-middleware-livereload": "^0.1.4",
    "ui5-middleware-simpleproxy": "^0.1.3",
    "ui5-middleware-servestatic": "^0.1.2",
    "ui5-task-nwabap-deployer": "1.0.1"
  },
  "ui5": {
    "dependencies": [
      "ui5-middleware-livereload",
      "ui5-middleware-simpleproxy",
      "ui5-middleware-servestatic",
      "ui5-task-nwabap-deployer"
    ]
  }
}
specVersion: "1.0"
metadata:
  name: <Your App Name>
type: application
# https://sap.github.io/ui5-tooling/pages/extensibility/CustomServerMiddleware/
server:
  customMiddleware:
  - name: ui5-middleware-livereload
    afterMiddleware: compression
    configuration:
      debug: true
      ext: "xml,json,properties"
      port: 35729
      path: "webapp"
  - name: ui5-middleware-simpleproxy
    mountPath: /sap/opu/odata/
    afterMiddleware: compression
    configuration:
      baseUri: "https://<Host and Port of your ABAP backend>/sap/opu/odata/"
  - name: ui5-middleware-servestatic
    mountPath: /resources
    afterMiddleware: compression
    configuration:
      rootPath: "./download/sapui5-rt-1.71.4/resources"
specVersion: "1.0"
metadata:
  name: <Your App Name>
type: application
resources:
  configuration:
    paths:
      webapp: dist
# https://sap.github.io/ui5-tooling/pages/extensibility/CustomServerMiddleware/
server:
  customMiddleware:
  - name: ui5-middleware-livereload
    afterMiddleware: compression
    configuration:
      debug: true
      ext: "xml,json,properties"
      port: 35729
      path: "dist"
  - name: ui5-middleware-simpleproxy
    mountPath: /sap/opu/odata/
    afterMiddleware: compression
    configuration:
      baseUri: "https://<Host and Port of your ABAP backend for testing>/sap/opu/odata/"
  - name: ui5-middleware-servestatic
    mountPath: /resources
    afterMiddleware: compression
    configuration:
      rootPath: "./download/sapui5-rt-1.71.4/resources"
builder:
  customTasks:
  - name: ui5-task-nwabap-deployer
    afterTask: generateVersionInfo
    configuration:
      resources:
        path: "dist"
        pattern: "**/*.*"
      connection:
        server: https://<Host and Port of your ABAP backend for deployment>
        client: '<ABAP Client to use>'
        useStrictSSL: true
      authentication:
        user:
        password:
      ui5:
        calculateApplicationIndex: true
        language: EN
        package: <Package needed for creation>
        bspContainer: <Target UI5 Repository>
        bspContainerText: <Description for creation>
        createTransport: true
        transportText: <Description for transport to create>
        transportUseUserMatch: true
        transportUseLocked: true

Answer by Elliot Cannon


Answer by Lana Gilbert


Answer by Alma Cordova

CDNs have code execution limitations, such as short timeouts,We can then deploy the above resources to AWS via ‘npm run deploy‘:,Next we can run ‘npm run deploy‘ in order to deploy the ZIP files to AWS, which will create API Gateway HTTPS Endpoints that route to the API implementation code:

An important point to understand is that the JSON format must be written like this, so that the message property of the AWS log event consists of JSON on a single line:

process.stdout.write(JSON.stringify(data) + 'n');

I administer my Elastic Cloud instance as the default elastic user and used the simplest option for creating an API key. This key is used when pushing data from the AWS FunctionBeat lambda to Elastic Cloud:

POST /_security/api_key
{
  "name": "functionbeat-api-key"
}

If we click Reload Data a few times we will see new log entries in Kibana within a couple of seconds. Our UI and API design enables the user to filter logs on their UI’s own API calls, with a SQL like syntax:

POST _sql?format=txt
{
  "query": "SELECT userId, apiName, operationName from apilogs where apiName='SampleApi' and operationName='getCompanyTransactions' and sessionId='0e956bbe-c96e-ff9a-d8da-2312668b7f69' order by utcTime desc"
}

Answer by Judah Benjamin

Step-10: Execute the following command to commit the added files/changes.,Step-11: Execute the following command to push the changes to Git-Hub master branch.,Step-9: Execute the following command to add the changes to Git-Hub queue to be committed later.

This is a data cache which can be used to cache frequently used domain data which ideally changes once in a while

 if (System.Runtime.Caching.MemoryCache.Default["MemberShipTypes"] == null)
            {
                System.Runtime.Caching.MemoryCache.Default["MemberShipTypes"] = _context.MembershipTypes.ToList();
            }

            var membershiptypes = System.Runtime.Caching.MemoryCache.Default["MemberShipTypes"] as IEnumerable<MembershipTypes>;

Sessions kill the performance and scalability of the applications, so disable the session by adding the following line in the Web.config file.

<system.web>
   <sessionState mode="Off"></sessionState>
</system.web>

Возможно, вам также будет интересно:

  • Npm install windows ошибка
  • Npm install pug cli g ошибка
  • Npm install g jshint ошибка
  • Npm install discord js ffmpeg binaries opusscript ytdl core save ошибка
  • Npm init y ошибка

  • Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии