Skip to content
New issue

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.

Already on GitHub? Sign in to your account

windows 8 :The syntax of the command is incorrect. npm ERR! code ELIFECYCLE #13

Open
vishalsdoijode opened this issue Jul 9, 2017 · 6 comments

Comments

@vishalsdoijode
Copy link

I had tough time setting up this simpe solution on windows ,seems like it is very outdated

bundle.js 3.11 kB 0 [emitted] main [0] ./src/app/index.js 40 bytes {0} [built]
The syntax of the command is incorrect.
npm ERR! code ELIFECYCLE

output :

bundle.js 3.11 kB 0 [emitted] main
[0] ./src/app/index.js 40 bytes {0} [built]
The syntax of the command is incorrect.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactbasic1@1.0.0 build: webpack -d && copy src/index.html dist/index.html && webpack-dev-server --content-base sr c/ --inline --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactbasic1@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Not sure if it is very outdated .
Dev dependencies:
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"webpack": "^3.0.0",
"webpack-dev-server": "^2.5.0"
}

@vishalsdoijode vishalsdoijode changed the title windows 8 windows 8 :The syntax of the command is incorrect. npm ERR! code ELIFECYCLE Jul 9, 2017
@vishalsdoijode
Copy link
Author

Resolved it :
resolve-url-loader is added in the prod dependencies and it it worked .

and changed the url from / to \ in windows

@murlidhar196
Copy link

@vishaldj88 i am also stuck in the same problem. It came again even it was working before. Please leaborate this part "changed the url from / to \ in windows".

@vishalsdoijode
Copy link
Author

In windows it accepts \ in place of / in your webpac config

@satyadk
Copy link

satyadk commented May 21, 2018

@vishaldj88 I am also getting the same error. but I was not able to figure where did you replace / with \ for windows.

Below is my package.json and webpack.config.js . Please tell me where did you make the change to resolve this issue. TIA.

package.json
{
"name": "reactjs-basics",
"version": "1.0.0",
"description": "Basic React JS ",
"main": "index.js",
"scripts": {
"start": "npm run build",
"build": "webpack -d && copy src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot",
"build:prod": "webpack -p && cp src/index.html dist/index.html"
},
"keywords": [
"reactjs",
"react"
],
"author": "satyadk",
"license": "MIT",
"dependencies": {
"react": "^16.3.2",
"react-dom": "^16.3.2"
},
"devDependencies": {
"babel-loader": "^7.1.4",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"resolve-url-loader": "^2.3.0",
"webpack": "^4.8.3",
"webpack-cli": "^2.1.3",
"webpack-dev-server": "^3.1.4"
}
}

webpack.config.js

var webpack = require("webpack");
var path = require("path");

var DIST_DIR = path.resolve(__dirname, "dist");
var SRC_DIR = path.resolve(__dirname, "src");

var config = {
entry: SRC_DIR + "/app/index.js",
output: {
path : DIST_DIR + "/app",
filename: "bundle.js",
publicPath: "/app"
},
module: {
rules: [
{
test: /.js?/,
include: SRC_DIR,
loader: "babel-loader",
query : {
presets: [ "react", "es2015", "stage-2" ]
}
}
]

}

} ;

module.exports = config;

@KidusMT
Copy link

KidusMT commented Jul 2, 2018

@satyadk did you resolve your problem I am getting the same error. and I am on windows too.

@satyadk
Copy link

satyadk commented Jul 4, 2018

@KidusMT

I changed as below, in package.json
After change :

  "scripts": {
    "start": "npm run build",
    "build": "webpack -d && copy src\\index.html dist\\index.html /Y && webpack-dev-server --content-base src/ --inline --hot", 
    "build:prod": "webpack -p && copy src\\index.html dist\\index.html"
  },

Before change :

"scripts": {
"start": "npm run build",
"build": "webpack -d && copy src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot",
"build:prod": "webpack -p && cp src/index.html dist/index.html"
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants