phuocng/1loc

Not working on window machine

kenchoong opened this issue · 2 comments

When I tried to run npm run dev-server I get this error:

D:\Desktop\1loc>npm run dev-server

> 1loc@ dev-server D:\Desktop\1loc
> npm run copy && npm run data && webpack-dev-server


> 1loc@ copy D:\Desktop\1loc
> rm -rf dist && mkdir dist && cp -rf public/* dist

'rm' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! 1loc@ copy: `rm -rf dist && mkdir dist && cp -rf public/* dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 1loc@ copy 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!   \2020-07-28T14_20_19_677Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! 1loc@ dev-server: `npm run copy && npm run data && webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 1loc@ dev-server 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!    -debug.log

is it the rm -rf command is not for window?

I tried to modify line of copy like this

"copy": "rimraf dist && mkdir dist && copy 'public/*' 'dist'"

Then install

npm install rimraf -g

npm run dev-server

But it still not work. Getting this error :

The system cannot find the file specified.

For Window I able to solve this:

First:
npm install --save-dev copyfiles to install copyfiles

Then
npm install --save-dev rimraf

Then modify copy in packages.json like this:
"copy": "rimraf dist && mkdir dist && npx copyfiles public/* dist"

Finally:
npm run dev-server