0

I am getting the below error every time in my command prompt basically I am unable to open my server because of the start in package.json is throwing the error, i am not able to find what issue is, please advice what is the correct way

Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\user>d:

D:>cd reactApp

D:\reactApp>npm install -g npm@latest
C:\Users\user\AppData\Roaming\npm\npm -> C:\Users\user\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
C:\Users\user\AppData\Roaming\npm\npx -> C:\Users\user\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
+ npm@5.8.0
added 523 packages in 116.024s

D:\reactApp>rm -rf node_modules
'rm' is not recognized as an internal or external command,
operable program or batch file.

D:\reactApp>npm -rf node_modules

Usage: npm <command>

where <command> is one of:
access, adduser, bin, bugs, c, cache, ci, completion,
config, ddp, dedupe, deprecate, dist-tag, docs, doctor,
edit, explore, get, help, help-search, i, init, install,
install-test, it, link, list, ln, login, logout, ls,
outdated, owner, pack, ping, prefix, profile, prune,
publish, rb, rebuild, repo, restart, root, run, run-script,
s, se, search, set, shrinkwrap, star, stars, start, stop, t,
team, test, token, tst, un, uninstall, unpublish, unstar,
up, update, v, version, view, whoami

npm -h quick help on npm -l display full usage info npm help search for help on npm help npm involved overview

Specify configs in the ini-formatted file:
    C:\Users\user\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@5.8.0 C:\Users\user\AppData\Roaming\npm\node_modules\npm

D:\reactApp>npm install

npm WARN babel-loader@7.1.4 requires a peer of babel-core@6 but none is installed. You must install peer dependencies yourself. npm WARN reactapp@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

removed 10 packages in 21.906s

D:\reactApp>npm start

> reactapp@1.0.0 start D:\reactApp
> npm run build


> reactapp@1.0.0 build D:\reactApp
> webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot

The CLI moved into a separate package: webpack-cli.
Please install 'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactapp@1.0.0 build: `webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactapp@1.0.0 build 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:\Users\user\AppData\Roaming\npm-cache\_logs\2018-03-27T03_57_54_881Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactapp@1.0.0 start: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactapp@1.0.0 start 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:\Users\user\AppData\Roaming\npm-cache\_logs\2018-03-27T03_57_54_983Z-debug.log

D:\reactApp>npm install -g react-scripts
C:\Users\user\AppData\Roaming\npm\react-scripts -> C:\Users\user\AppData\Roaming\npm\node_modules\react-scripts\bin\react-scripts.js

> uglifyjs-webpack-plugin@0.4.6 postinstall C:\Users\user\AppData\Roaming\npm\node_modules\react-scripts\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js

npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ react-scripts@1.1.1
added 1324 packages from 785 contributors in 453.077s

D:\reactApp>npm start

> reactapp@1.0.0 start D:\reactApp
> npm run build


> reactapp@1.0.0 build D:\reactApp
> webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot

The CLI moved into a separate package: webpack-cli.
Please install 'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactapp@1.0.0 build: `webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactapp@1.0.0 build 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:\Users\user\AppData\Roaming\npm-cache\_logs\2018-03-27T04_06_58_572Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactapp@1.0.0 start: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactapp@1.0.0 start 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:\Users\user\AppData\Roaming\npm-cache\_logs\2018-03-27T04_06_58_697Z-debug.log

D:\reactApp>npm start

my package.json file is

{
  "name": "reactapp",
  "version": "1.0.0",
  "description": "some basics reactjs",
  "main": "index.js",
  "scripts": {
    "start": "npm run build",
    "build": "webpack -d && cp 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"
  ],
  "author": "Harsh mewari",
  "license": "ISC",
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0"
  },
  "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",
    "webpack": "^4.2.0",
    "webpack-dev-server": "^3.1.1"
  }
}

my webpack.config.js file is
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"

   },
   modules:{
       loaders:[
       {
        test:/\.js?/,
        include: SRC_DIR,
        loader:"babel-loader",
        query:{
            presets:["react","es2015","stage-2"]
        }
       }
     ]
   };
module.exports= config;
}
harsh mewari
  • 11
  • 1
  • 5
  • 1
    Well for the first part, you're trying to use Linux commands in a Windows OS. For the `npm start` part, looks like it uses Webpack to build it and if 'webpack' isn't available as a command in your environment then it won't work. – Jayce444 Mar 27 '18 at 04:51
  • look at this for the first part - https://stackoverflow.com/questions/97875/rm-rf-equivalent-for-windows – Yash Sharma Mar 27 '18 at 05:21

0 Answers0