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

65.9k64 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

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 :)

I am developing react app in my localhost and try to deploy the code into github page.

But while running the command npm run deploy its shows below error.

PS D:Projectsportfolio-app> npm run deploy

> portfolio-app@0.1.0 predeploy D:Projectsportfolio-app
> npm run build


> portfolio-app@0.1.0 build D:Projectsportfolio-app
> react-scripts build

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  41.69 KB  buildstaticjs2.b0b79569.chunk.js
  2.35 KB   buildstaticjsmain.2ad86f1d.chunk.js
  1.4 KB    buildstaticjs3.dc241c04.chunk.js
  1.17 KB   buildstaticjsruntime-main.b7252dff.js
  546 B     buildstaticcssmain.ab7136cd.chunk.css

The project was built assuming it is hosted at /me/.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Find out more about deployment here:

  https://cra.link/deployment


> portfolio-app@0.1.0 deploy D:Projectsportfolio-app
> gh-pages -b master -d build

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn git ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn git',
  path: 'git',
  spawnargs: [ 'config', 'user.name' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio-app@0.1.0 deploy: `gh-pages -b master -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio-app@0.1.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!     C:UsersAppDataRoamingnpm-cache_logs2021-01-04T14_20_16_803Z-debug.log
PS D:Projectsportfolio-app> 

Когда делал тестовое пришла информация, что нужно закинуть сайт на хост 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

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

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

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

Скорее всего возникает при 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 для настр…


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

09 июн. 2023, в 01:21

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

09 июн. 2023, в 01:06

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

09 июн. 2023, в 00:36

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

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

The freeCodeCamp Forum

Loading

#reactjs #git #npm

#reactjs #git #npm

Вопрос:

Я разрабатываю приложение react на своем локальном хостинге и пытаюсь развернуть код на странице github.

Но при выполнении команды npm run deploy отображается ошибка ниже.

 PS D:Projectsportfolio-app> npm run deploy

> portfolio-app@0.1.0 predeploy D:Projectsportfolio-app
> npm run build


> portfolio-app@0.1.0 build D:Projectsportfolio-app
> react-scripts build

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  41.69 KB  buildstaticjs2.b0b79569.chunk.js
  2.35 KB   buildstaticjsmain.2ad86f1d.chunk.js
  1.4 KB    buildstaticjs3.dc241c04.chunk.js
  1.17 KB   buildstaticjsruntime-main.b7252dff.js
  546 B     buildstaticcssmain.ab7136cd.chunk.css

The project was built assuming it is hosted at /me/.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Find out more about deployment here:

  https://cra.link/deployment


> portfolio-app@0.1.0 deploy D:Projectsportfolio-app
> gh-pages -b master -d build

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn git ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn git',
  path: 'git',
  spawnargs: [ 'config', 'user.name' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio-app@0.1.0 deploy: `gh-pages -b master -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio-app@0.1.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!     C:UsersAppDataRoamingnpm-cache_logs2021-01-04T14_20_16_803Z-debug.log
PS D:Projectsportfolio-app> 
 

Ответ №1:

Answer by Grace Carter

So I run this command npm install —save gh-pages ,After that I run the command npm run deploy,please install gh-pages and it ready to go

To install

npm install gh-pages

add this to package.json

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

and then this

npm run deploy

Answer by Lorelei Hudson

I just developped my first website based on HTML SCSS and JS.,I arrived to import it on my github rep while using ‘git remode add…’ ‘git push…’ and there isn’t any problems. My files are all there you can check it https://github.com/StefanYYC/testsite,I even tried to switch my default branch on my project and I put gh-pages, I saw that for some ppl it was working.

Here is my package.json with my deploy script 

{
  "name": "porte_folio_stefan",
  "version": "1.0.0",
  "description": "Site portefolio responsive",
  "main": "index.js",
  "homepage": "https://stefanyyc.github.io/testsite",
  "scripts": {
    "sass": "node-sass -w scss/ -o dist/css/ --recursive",
    "deploy": "gh-pages -d dist"
  },
  "author": "Stefan Speter",
  "license": "MIT",
  "dependencies": {
    "gh-pages": "^2.0.1",
    "node-sass": "^4.11.0"
  }
}

Answer by Cruz Mann

I’m just trying to follow your «Deploy your own video collaboration app in five minutes or less» instructions for the ReactJs web app, and it fails when I run npm run deploy:twilio-cli,
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
,By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy:twilio-cli: `cross-env REACT_APP_SET_AUTH=passcode npm run build && twilio rtc:apps:video:deploy --authentication=passcode --app-directory ./build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy:twilio-cli script.

Answer by Cash Macias

3:51:58 PM: Error message
3:51:58 PM: Command failed with exit code 254: npm run build,There is not a package.json file in the root of your repository. It is in the folder ‘mitch-portfolio’. You need to set the base directory in your Netlify site settings to ‘mitch-portfolio’.,By errors, I assume it’s an issue where npm run build doesn’t work because there’s no package.json file inside the build folder.

There is a package.json file on the root. When I do npm run build for the first time, it does create a build folder, but not a package.json file inside of it. Is that normal?

{
  "name": "mitch-portfolio",
  "version": "0.1.0",
  "private": false,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Answer by Skyler Howe

Your Node.js deploy failed — now what? Start with these simple steps to troubleshoot a build issue.,Troubleshooting Node.js Deploys,Heroku apps will not bind to just any port that your app is set up with. Apps should use the Node process to bind to a port.

To find out, run:

$ heroku buildpacks

To use the official buildpack, run:

$ heroku buildpacks:set heroku/nodejs

The production environment should mirror the app’s development environment as closely as possible. (Being a few patch versions off is okay.) First, check local versions:

$ node --version
$ npm --version

Heroku will output which binaries (ie. node, npm) are used for each deploy in the build logs:

remote: -----> Installing binaries
remote:        Resolving node version 12.x...
remote:        Downloading and installing node 12.16.3...
remote:        Using default npm version: 6.14.4

The app’s node_modules directory is generated at build time from the dependencies listed in package.json and the lockfile. Therefore, node_modules (and other generated directories like bower_components) shouldn’t be included in source control. Check with the following:

$ git ls-files | grep node_modules

If there are results, then instruct git to stop tracking node_modules:

$ echo "node_modules" >> .gitignore
$ git rm -r --cached node_modules
$ git commit -am 'untracked node_modules'

Occasionally, this can lead to subtle bugs that will only show up when trying to deploy. If a new bug appears while deploying, check to see if it can be reproduced locally by setting NODE_ENV to production.

$ NODE_ENV=production npm start

As an example, it may be better to exclude a lib directory at the root of your application, but with the following:

lib/

git will recursively match any subdirectory named lib, so the file js/library-name/lib/index.js would not be included in the git repo. Fix this case by moving the slash to the front, which will only match the lib directory in the application root directory.

/lib

If builds are not completing with an error when downloading Node, there may be an issue downloading binaries. The build error may look like following:

-----> Installing binaries
       engines.node (package.json):  10
       engines.npm (package.json):   unspecified (use default)

       Resolving node version 10...
       Error: Unknown error installing "10" of node

Or the error may mention this:

-----> Node.js app detected
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to lang-common.s3.amazonaws.com:443

Setting the HTTP_PROXY or HTTPS_PROXY environment variables in the app’s build will cause these types of failures. If the build or app does not need HTTP_PROXY or HTTPS_PROXY environment variables, it’s recommended to remove the variables from the app’s environment.

$ heroku config:unset HTTP_PROXY HTTPS_PROXY

If the build environment does require a proxy to be used for HTTP or HTTPS connections, set the NO_PROXY environment variable to amazonaws.com. This can be done by setting this in the environment (ie. export NO_PROXY=amazonaws.com) before executing the Node process, or setting the environment variable:

$ heroku config:set NO_PROXY=amazonaws.com

If a module that is included in the package.json is missing from the build or the production app, it may have been removed by Heroku during pruning. A common error would look something like this:

internal/modules/cjs/loader.js:960
  throw err;
  ^

Error: Cannot find module 'express'

The other solution is to turn off pruning of devDependencies altogether. To do this, set the following for npm:

$ heroku config:set NPM_CONFIG_PRODUCTION=false

If the app is using Yarn, run the following:

$ heroku config:set YARN_PRODUCTION=false

When set up incorrectly, your app will deploy successfully, but the app will crash repeatedly. You may see an error like this in your logs:

heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" status=503 bytes= protocol=https

To fix this, use the process.env.PORT variable to bind your web server to the port. If you’re using port 3000 for your local development, your code should look something like this:

app.listen(process.env.PORT || 3000);

Once you’ve deployed the code to a staging app, create the one-off dyno:

heroku run bash -a $APP_NAME

Running bash on ⬢ app-name... up, run.2524 (Hobby)
$

After the dyno has spun up, you can poke around and run scripts to debug. Install dependencies as needed to poke around the dyno:

$ npm install debug

up to date, audited 52 packages in 2s

found 0 vulnerabilities

If you cat the package.json, you’ll see that debug has been installed. You may also have a failing build script — it can be run it manually with the verbose flag:

$ npm run build-production --verbose

Answer by Louisa Moss

Azure Pipelines will generate a YAML file for your pipeline. Select Save and run, then select Commit directly to the main branch, and then choose Save and run again.,Azure Pipelines will generate a YAML file for your pipeline. Select Save and run, then select Commit directly to the main branch, and then choose Save and run again.
,Set the Agent pool and YAML file path for your pipeline.

Fork this repo in GitHub:

https://github.com/MicrosoftDocs/pipelines-javascript

Answer by Alberto Palacios

Now, after you create a production build with npm run build, you can deploy it by running firebase deploy.,Now requests to /todos/42 will be handled correctly both in development and in production.,Make sure the build folder is set correctly on the «build» tab and create the resource.


I am trying to compile files with webpack and npm for my reactJS applciation.

When I run npm start, it all goes well.
When I run npm run deploy or npm run build it does not work under a windows environment. It does work under a linux environment.

Does someone have an idea why ?

My files :

package.json

{
  "license": "UNLICENSED",
  "private": true,
  "version": "1.0.0",
  "webPath": "web/",
  "nodePath": "node_modules/",
  "devDependencies": {
    "autoprefixer": "^6.3.1",
    "exports-loader": "^0.6.2",
    "grunt": "^0.4.5",
    "grunt-autoprefixer": "^3.0.3",
    "grunt-contrib-concat": "^0.5.1",
    "grunt-contrib-cssmin": "^0.14.0",
    "grunt-contrib-less": "^1.1.0",
    "grunt-contrib-uglify": "^0.11.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-css-url-rewrite": "^0.3.5",
    "grunt-cssjoin": "^0.3.0",
    "grunt-postcss": "^0.7.1",
    "imports-loader": "^0.6.5",
    "matchdep": "^1.0.0",
    "redux-devtools": "^3.0.2",
    "redux-devtools-dock-monitor": "^1.0.1",
    "redux-devtools-log-monitor": "^1.0.4",
    "webpack-shell-plugin": "^0.4.2"
  },
  "repository": {
    "type": "git",
    "url": ""
  },
  "dependencies": {
    "babel-core": "^6.4.0",
    "babel-loader": "^6.2.1",
    "babel-plugin-transform-runtime": "^6.4.3",
    "babel-polyfill": "^6.3.14",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "babel-preset-stage-0": "^6.3.13",
    "babel-runtime": "^6.3.19",
    "grunt-postcss": "^0.7.1",
    "history": "^1.17.0",
    "i18next": "^2.5.1",
    "isomorphic-fetch": "^2.2.1",
    "lodash": "^4.11.1",
    "radium": "^0.16.2",
    "rc-switch": "^1.4.2",
    "react": "^0.14.6",
    "react-dom": "^0.14.6",
    "react-hot-loader": "^1.3.0",
    "react-redux": "^4.1.2",
    "react-router": "^1.0.3",
    "react-router-redux": "^3.0.0",
    "redux": "^3.1.6",
    "redux-thunk": "^2.1.0",
    "selfupdate": "^1.1.0",
    "webpack": "^1.12.11",
    "webpack-dev-server": "^1.14.1",
    "whatwg-fetch": "^0.11.0"
  },
  "scripts": {
    "start": "node webpack.dev-server.js",
    "build": "webpack",
    "deploy": "NODE_ENV=production webpack -p --config webpack.production.config.js"
  }
}

webpack.config.js

var path = require('path');
var webpack = require('webpack');
var node_modules_dir = path.join(__dirname, 'node_modules');

var devFlagPlugin = new webpack.DefinePlugin({
    __DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
});

console.log(__dirname);

var config = {
    entry: [
        'babel-polyfill',
        'webpack-dev-server/client?http://127.0.0.1:3000',
        'webpack/hot/only-dev-server',
        './app/Resources/react/app.js'
    ],
    output: {
        path: path.join(__dirname, 'web/js'),
        filename: 'bundle.js',
        publicPath: 'http://127.0.0.1:3000/static/'
    },
    debug: true,
    devtool: 'eval',
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin(),
        devFlagPlugin
    ],
    module: {
        loaders: [
            {
                loaders: ["react-hot","babel-loader?plugins=transform-runtime&presets[]=es2015&presets[]=stage-0&presets[]=react"],
                test: /.js$/,
                include: path.join(__dirname, 'app/Resources/react')
            }
        ]
    }
};

module.exports = config;
/*
 new webpack.ProvidePlugin({
 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
 })
 */

webpack.dev-server.js

var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');

new WebpackDevServer(webpack(config), {
    publicPath: config.output.publicPath,
    hot: true,
    historyApiFallback: true,
    quiet: false,
    noInfo: false,
    contentBase: "./assets"
}).listen(3000, 'localhost', function (err, result) {
    if (err) {
        console.log(err);
    }
    console.log('Listening at localhost:3000');
});

webpack.production.config.js

var path = require('path');
var node_modules_dir = path.resolve(__dirname, 'node_modules');

var config = {
    entry: [
        'babel-polyfill',
        './app/Resources/react/app.js'
    ],
    debug: false,
    output: {
        path: path.join(__dirname, 'web/js'),
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            {
                loaders: ["babel-loader?plugins=transform-runtime&presets[]=es2015&presets[]=stage-0&presets[]=react"],
                test: /.js$/,
                include: path.join(__dirname, 'app/Resources/react')
            }
        ]
    },
    plugins: []
};

module.exports = config;

I get the following error with npm run build

Microsoft Windows [Version 10.0.10586] (c) 2015 Microsoft Corporation.
All rights reserved.

D:DiversProgrammationWebfoodmeup.dev>npm run build

FoodMeUp@1.0.0 build D:DiversProgrammationWebfoodmeup.dev
webpack

D:DiversProgrammationWebfoodmeup.dev Hash: 9cb8c898ada89430aa7c
Version: webpack 1.13.1 Time: 3353ms [0] multi main 64 bytes {0}
[built]
+ 739 hidden modules

ERROR in ./app/Resources/react/components/subscription/total.js Module
not found: Error: Cannot resolve module ‘lodash’ in
D:DiversProgrammationWebfoodmeup.devappResourcesreactcomponentssubscription
@ ./app/Resources/react/components/subscription/total.js 19:8-25

my total.js file :

import React from 'react';
import { connect } from 'react-redux';
import { updateSubscription } from '../../actions/subscription';
var _ = require('lodash');

...

I get the following error when I launch npm run deploy

D:DiversProgrammationWebfoodmeup.dev>npm run deploy

FoodMeUp@1.0.0 deploy D:DiversProgrammationWebfoodmeup.dev
NODE_ENV=production webpack -p –config webpack.production.config.js

‘NODE_ENV’ is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.10586 npm ERR! argv
«C:Developmentnodejsnode.exe»
«C:Developmentnodejsnode_modulesnpmbinnpm-cli.js» «run»
«deploy» npm ERR! node v6.2.2 npm ERR! npm v3.9.5 npm ERR! code
ELIFECYCLE npm ERR! FoodMeUp@1.0.0 deploy: NODE_ENV=production
webpack -p --config webpack.production.config.js
npm ERR! Exit status
1 npm ERR! npm ERR! Failed at the FoodMeUp@1.0.0 deploy script
‘NODE_ENV=production webpack -p –config
webpack.production.config.js’. 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 FoodMeUp package, npm ERR! not with npm
itself. npm ERR! Tell the author that this fails on your system: npm
ERR! NODE_ENV=production webpack -p –config
webpack.production.config.js npm ERR! You can get information on how
to open an issue for this project with: npm ERR! npm bugs FoodMeUp
npm ERR! Or if that isn’t available, you can get their info via: npm
ERR! npm owner ls FoodMeUp npm ERR! There is likely additional
logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:DiversProgrammationWebfoodmeup.devnpm-debug.log

and my npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Development\nodejs\node.exe',
1 verbose cli   'C:\Development\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'deploy' ]
2 info using npm@3.9.5
3 info using node@v6.2.2
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle FoodMeUp@1.0.0~predeploy: FoodMeUp@1.0.0
6 silly lifecycle FoodMeUp@1.0.0~predeploy: no script for predeploy, continuing
7 info lifecycle FoodMeUp@1.0.0~deploy: FoodMeUp@1.0.0
8 verbose lifecycle FoodMeUp@1.0.0~deploy: unsafe-perm in lifecycle true
9 verbose lifecycle FoodMeUp@1.0.0~deploy: PATH: C:Developmentnodejsnode_modulesnpmbinnode-gyp-bin;D:DiversProgrammationWebfoodmeup.devnode_modules.bin;C:Developmentnodejs;C:img;C:ProgramDataOracleJavajavapath;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:DevelopmentGitcmd;C:Program Files (x86)Windows LiveShared;C:Developmentwampbinphpphp7.0.0;C:Net GenerationFireFox;C:Developmentwampbinmysqlmysql5.7.9bin;C:Program Files (x86)SkypePhone;D:DiversProgrammationWebfoodmeup.devnode_modulestypescriptbin;C:Developmentnodejs;C:Developmentrubybin;C:Developmentwampbinphpphp7.0.0;C:Developmentwampbinmysqlmysql5.7.9bin;D:DiversProgrammationWebfoodmeup.devnode_modulestypescriptbin;C:img;C:UsersSébastienAppDataRoamingnpm
10 verbose lifecycle FoodMeUp@1.0.0~deploy: CWD: D:DiversProgrammationWebfoodmeup.dev
11 silly lifecycle FoodMeUp@1.0.0~deploy: Args: [ '/d /s /c',
11 silly lifecycle   'NODE_ENV=production webpack -p --config webpack.production.config.js' ]
12 silly lifecycle FoodMeUp@1.0.0~deploy: Returned: code: 1  signal: null
13 info lifecycle FoodMeUp@1.0.0~deploy: Failed to exec deploy script
14 verbose stack Error: FoodMeUp@1.0.0 deploy: `NODE_ENV=production webpack -p --config webpack.production.config.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:Developmentnodejsnode_modulesnpmlibutilslifecycle.js:245:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:Developmentnodejsnode_modulesnpmlibutilsspawn.js:24:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:852:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid FoodMeUp@1.0.0
16 verbose cwd D:DiversProgrammationWebfoodmeup.dev
17 error Windows_NT 10.0.10586
18 error argv "C:\Development\nodejs\node.exe" "C:\Development\nodejs\node_modules\npm\bin\npm-cli.js" "run" "deploy"
19 error node v6.2.2
20 error npm  v3.9.5
21 error code ELIFECYCLE
22 error FoodMeUp@1.0.0 deploy: `NODE_ENV=production webpack -p --config webpack.production.config.js`
22 error Exit status 1
23 error Failed at the FoodMeUp@1.0.0 deploy script 'NODE_ENV=production webpack -p --config webpack.production.config.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the FoodMeUp package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     NODE_ENV=production webpack -p --config webpack.production.config.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs FoodMeUp
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls FoodMeUp
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Я пытаюсь скомпилировать файлы с помощью webpack и npm для моего приложения responseJS.

Когда я запускаю npm start, все идет хорошо. Когда я запускаю npm run deploy или npm run build, он не работает в среде Windows. Он работает в среде linux.

У кого-то есть идея, почему?

Мои файлы:

package.json

{
  "license": "UNLICENSED",
  "private": true,
  "version": "1.0.0",
  "webPath": "web/",
  "nodePath": "node_modules/",
  "devDependencies": {
    "autoprefixer": "^6.3.1",
    "exports-loader": "^0.6.2",
    "grunt": "^0.4.5",
    "grunt-autoprefixer": "^3.0.3",
    "grunt-contrib-concat": "^0.5.1",
    "grunt-contrib-cssmin": "^0.14.0",
    "grunt-contrib-less": "^1.1.0",
    "grunt-contrib-uglify": "^0.11.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-css-url-rewrite": "^0.3.5",
    "grunt-cssjoin": "^0.3.0",
    "grunt-postcss": "^0.7.1",
    "imports-loader": "^0.6.5",
    "matchdep": "^1.0.0",
    "redux-devtools": "^3.0.2",
    "redux-devtools-dock-monitor": "^1.0.1",
    "redux-devtools-log-monitor": "^1.0.4",
    "webpack-shell-plugin": "^0.4.2"
  },
  "repository": {
    "type": "git",
    "url": ""
  },
  "dependencies": {
    "babel-core": "^6.4.0",
    "babel-loader": "^6.2.1",
    "babel-plugin-transform-runtime": "^6.4.3",
    "babel-polyfill": "^6.3.14",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "babel-preset-stage-0": "^6.3.13",
    "babel-runtime": "^6.3.19",
    "grunt-postcss": "^0.7.1",
    "history": "^1.17.0",
    "i18next": "^2.5.1",
    "isomorphic-fetch": "^2.2.1",
    "lodash": "^4.11.1",
    "radium": "^0.16.2",
    "rc-switch": "^1.4.2",
    "react": "^0.14.6",
    "react-dom": "^0.14.6",
    "react-hot-loader": "^1.3.0",
    "react-redux": "^4.1.2",
    "react-router": "^1.0.3",
    "react-router-redux": "^3.0.0",
    "redux": "^3.1.6",
    "redux-thunk": "^2.1.0",
    "selfupdate": "^1.1.0",
    "webpack": "^1.12.11",
    "webpack-dev-server": "^1.14.1",
    "whatwg-fetch": "^0.11.0"
  },
  "scripts": {
    "start": "node webpack.dev-server.js",
    "build": "webpack",
    "deploy": "NODE_ENV=production webpack -p --config webpack.production.config.js"
  }
}

webpack.config.js

var path = require('path');
var webpack = require('webpack');
var node_modules_dir = path.join(__dirname, 'node_modules');

var devFlagPlugin = new webpack.DefinePlugin({
    __DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
});

console.log(__dirname);

var config = {
    entry: [
        'babel-polyfill',
        'webpack-dev-server/client?http://127.0.0.1:3000',
        'webpack/hot/only-dev-server',
        './app/Resources/react/app.js'
    ],
    output: {
        path: path.join(__dirname, 'web/js'),
        filename: 'bundle.js',
        publicPath: 'http://127.0.0.1:3000/static/'
    },
    debug: true,
    devtool: 'eval',
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin(),
        devFlagPlugin
    ],
    module: {
        loaders: [
            {
                loaders: ["react-hot","babel-loader?plugins=transform-runtime&presets[]=es2015&presets[]=stage-0&presets[]=react"],
                test: /.js$/,
                include: path.join(__dirname, 'app/Resources/react')
            }
        ]
    }
};

module.exports = config;
/*
 new webpack.ProvidePlugin({
 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
 })
 */

webpack.dev-server.js

var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');

new WebpackDevServer(webpack(config), {
    publicPath: config.output.publicPath,
    hot: true,
    historyApiFallback: true,
    quiet: false,
    noInfo: false,
    contentBase: "./assets"
}).listen(3000, 'localhost', function (err, result) {
    if (err) {
        console.log(err);
    }
    console.log('Listening at localhost:3000');
});

webpack.production.config.js

var path = require('path');
var node_modules_dir = path.resolve(__dirname, 'node_modules');

var config = {
    entry: [
        'babel-polyfill',
        './app/Resources/react/app.js'
    ],
    debug: false,
    output: {
        path: path.join(__dirname, 'web/js'),
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            {
                loaders: ["babel-loader?plugins=transform-runtime&presets[]=es2015&presets[]=stage-0&presets[]=react"],
                test: /.js$/,
                include: path.join(__dirname, 'app/Resources/react')
            }
        ]
    },
    plugins: []
};

module.exports = config;

Я получаю следующую ошибку при запуске npm run

Microsoft Windows [версия 10.0.10586] (c) 2015 Корпорация Microsoft. Все права защищены.

D:DiversProgrammationWebfoodmeup.dev> npm run build

FoodM[email protected] build D:DiversProgrammationWebfoodmeup.dev webpack

D:DiversProgrammationWebfoodmeup.dev Хеш: 9cb8c898ada89430aa7c Версия: webpack 1.13.1 Время: 3353ms [0] Несколько основных 64 байтов {0} [built] + 739 скрытых модулей

ERROR в. /app/Resources/react/components/subscription/total.js Модуль не найден: ошибка: невозможно разрешить модуль lodash в D:DiversProgrammationWebfoodmeup.devappResourcesreactcomponentsПодписка @./app/Resources/react/components/subscription/total.js 19: 8-25

мой файл total.js:

import React from 'react';
import { connect } from 'react-redux';
import { updateSubscription } from '../../actions/subscription';
var _ = require('lodash');

...

Я получаю следующую ошибку при запуске npm run deploy

D:DiversProgrammationWebfoodmeup.dev> npm запустить развернуть

[email protected] развертывание D:DiversProgrammationWebfoodmeup.dev NODE_ENV = веб-сайт для обработки -p —config webpack.production.config.js

«NODE_ENV» не распознается как внутренняя или внешняя команда, операционная программа или командный файл.

npm ERR! Windows_NT 10.0.10586 npm ERR! argv «C:Developmentnodejsnode.exe» «C:Developmentnodejsnode_modulesnpmbinnpm-cli.js» «запустить» «развернуть» npm ERR! узел v6.2.2 npm ERR! npm v3.9.5 npm ERR! код ELIFECYCLE npm ERR! [email protected] развернуть: NODE_ENV=production webpack -p --config webpack.production.config.js npm ERR! Состояние выхода 1 npm ERR! npm ERR! Не удалось выполнить сценарий развертывания [email protected] «NODE_ENV = производственный веб-пакет -p —config webpack.production.config.js». npm ERR! Убедитесь, что установлена последняя версия node.js и npm. npm ERR! Если вы это сделаете, это, скорее всего, проблема с пакетом FoodMeUp, npm ERR! а не с самим часом. npm ERR! Скажите автору, что это не работает в вашей системе: npm ERR! NODE_ENV = производственный веб-пакет -p —config webpack.production.config.js npm ERR! Вы можете получить информацию о том, как открыть проблему для этого проекта с помощью: npm ERR! npm ошибки FoodMeUp npm ERR! Или, если это не доступно, вы можете получить их информацию через: npm ERR! npm владелец ls FoodMeUp npm ERR! Вероятно, имеется дополнительный выход для регистрации.

npm ERR! Пожалуйста, укажите следующий файл с любым запросом поддержки: npm ERR! D:DiversProgrammationWebfoodmeup.devNPM-debug.log

и мой npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Development\nodejs\node.exe',
1 verbose cli   'C:\Development\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'deploy' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle [email protected]~predeploy: [email protected]
6 silly lifecycle [email protected]~predeploy: no script for predeploy, continuing
7 info lifecycle [email protected]~deploy: [email protected]
8 verbose lifecycle [email protected]~deploy: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~deploy: PATH: C:Developmentnodejsnode_modulesnpmbinnode-gyp-bin;D:DiversProgrammationWebfoodmeup.devnode_modules.bin;C:Developmentnodejs;C:img;C:ProgramDataOracleJavajavapath;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:DevelopmentGitcmd;C:Program Files (x86)Windows LiveShared;C:Developmentwampbinphpphp7.0.0;C:Net GenerationFireFox;C:Developmentwampbinmysqlmysql5.7.9bin;C:Program Files (x86)SkypePhone;D:DiversProgrammationWebfoodmeup.devnode_modulestypescriptbin;C:Developmentnodejs;C:Developmentrubybin;C:Developmentwampbinphpphp7.0.0;C:Developmentwampbinmysqlmysql5.7.9bin;D:DiversProgrammationWebfoodmeup.devnode_modulestypescriptbin;C:img;C:UsersSébastienAppDataRoamingnpm
10 verbose lifecycle [email protected]~deploy: CWD: D:DiversProgrammationWebfoodmeup.dev
11 silly lifecycle [email protected]~deploy: Args: [ '/d /s /c',
11 silly lifecycle   'NODE_ENV=production webpack -p --config webpack.production.config.js' ]
12 silly lifecycle [email protected]~deploy: Returned: code: 1  signal: null
13 info lifecycle [email protected]~deploy: Failed to exec deploy script
14 verbose stack Error: [email protected] deploy: 'NODE_ENV=production webpack -p --config webpack.production.config.js'
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:Developmentnodejsnode_modulesnpmlibutilslifecycle.js:245:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:Developmentnodejsnode_modulesnpmlibutilsspawn.js:24:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:852:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid [email protected]
16 verbose cwd D:DiversProgrammationWebfoodmeup.dev
17 error Windows_NT 10.0.10586
18 error argv "C:\Development\nodejs\node.exe" "C:\Development\nodejs\node_modules\npm\bin\npm-cli.js" "run" "deploy"
19 error node v6.2.2
20 error npm  v3.9.5
21 error code ELIFECYCLE
22 error [email protected] deploy: 'NODE_ENV=production webpack -p --config webpack.production.config.js'
22 error Exit status 1
23 error Failed at the [email protected] deploy script 'NODE_ENV=production webpack -p --config webpack.production.config.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the FoodMeUp package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     NODE_ENV=production webpack -p --config webpack.production.config.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs FoodMeUp
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls FoodMeUp
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Понравилась статья? Поделить с друзьями:
  • Np 38551 2 ошибка ps4
  • Np 37614 1 ошибка ps4
  • Np 34924 2 ps4 ошибка
  • Not a square matrix ошибка в маткаде
  • Not a group by expression oracle ошибка