reactjs-basics: 'cp' is not recognized as an internal or external command,

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

npm ERR! Windows_NT 6.1.7601
npm ERR! argv “D:\dev\nodejs\node.exe” “D:\Dev\nodejs\node_modules\npm\bin\npm-cli.js” “run” “build”
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! reactjs-basics@1.0.0 build: webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --in line --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs-basics@1.0.0 build script ‘webpack -d && cp src/index.html dist/index.html && webpack-dev-server --co ntent-base src/ --inline --hot’.
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 reactjs-basics package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs reactjs-basics
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls reactjs-basics
npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request:
npm ERR! d:\work\reactjs\basic\npm-debug.log

npm ERR! Windows_NT 6.1.7601
npm ERR! argv “D:\dev\nodejs\node.exe” “D:\Dev\nodejs\node_modules\npm\bin\npm-cli.js” “start”
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! reactjs-basics@1.0.0 start: npm run build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs-basics@1.0.0 start script ‘npm run 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 reactjs-basics package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs reactjs-basics
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls reactjs-basics
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! d:\work\reactjs\basic\npm-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 20 (1 by maintainers)

Most upvoted comments

if you’re running windows you have to replace “cp” with “copy”, as far as i know

I used following for windows and it worked: webpack -d && copy src\\index.html dist\\index.html && webpack-dev-server --content-base src --inline --hot

copy src\\index.html dist\\index.html

or just

copy tools\\Web.config dist\\

I used following for windows and it worked: webpack -d && copy src\\index.html dist\\index.html && webpack-dev-server --content-base src --inline --hot

It worked for me as well i changed frm this–> "cp ./data/orig-db.json ./data/db.json && json-server --watch ./data/db.json" to this–> "copy .\\data\\orig-db.json .\\data\\db.json && json-server --watch .\\data\\db.json"

i got some work around but thanks anyway @medigvijay and i will try this …

– copy src\index.html dist\index.html

instead of this – copy src/index.html dist/index.html

I’m actually new on this stuff but I’m really at the bottom right now…Why it’s possible to run “cp -r data/ dist” on terminal but using npm it does not work? I’ve tried “cp -r data/ dist” and “copy data// dist//”, both work on terminal but none of then run using npm. What am I doing wrong?

I guess this video will be useful… install npm with help of this video: https://www.youtube.com/watch?v=3FKMOxz05Tg&feature=em-comments

If you are using window then type copy instead of cp

I too am having this same problem. I have tried all of the suggestions listed here and none of them work on Windows 10.

You need to install Core and Loader as dev-dependencies. Do this: npm install babel-core babel-loader --save-dev Change your build to - webpack -d && copy src\index.html dist\index.html && webpack-dev-server --content-base src --inline --hot Change your build:prod to - webpack -p && copy src/index.html dist/index.html

i got same error but when i change “cp” to “copy” i got – “the syntax of the command is incorrect”

please help …

The syntax of the command is incorrect.

npm ERR! Windows_NT 10.0.10240 npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Users\$user$\AppData\Roaming\npm\node_modules\npm\bin\np m-cli.js” “run” “build” npm ERR! node v7.3.0 npm ERR! npm v4.0.5 npm ERR! code ELIFECYCLE npm ERR! auth@1.0.0 build: webpack -d && copy src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot npm ERR! Exit status 1