pmadruga / react-native-clean-project

Automating the clean up of a React Native project
MIT License
1.21k stars 53 forks source link

Why clean pods cache on windows? #87

Closed huanguolin closed 2 years ago

huanguolin commented 2 years ago

When I run the command npm run clean I get the following error and the process terminates. My package.json config as:

 "scripts": {
        "clean": "react-native clean-project-auto",
> react-native clean-project-auto

Executing fully-automated project clean.
Use 'react-native clean-project' for more control
Use `./node_modules/.bin/react-native-clean-project' for total control

Error running 'wipe system iOS Pods cache': 'pod' is not recognized as an internal or external command,
operable program or batch file.

❌  Command 'wipe system iOS Pods cache' failed with code: 1
C:\SourceCode\test\node_modules\metro-hermes-compiler\src\emhermesc.js:77
          throw ex;
          ^

RuntimeError: abort(TypeError: Cannot read property 'message' of undefined). Build with -s ASSERTIONS=1 for more info.
    at process.abort (C:\SourceCode\test\node_modules\metro-hermes-compiler\src\emhermesc.js:440:13)
    at process.emit (events.js:400:28)
    at processPromiseRejections (internal/process/promises.js:245:33)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
The system cannot find the path specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test@0.0.1 clean: `react-native clean-project-auto`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test@0.0.1 clean script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

os: windows 10 version: 3.6.7

pmadruga commented 2 years ago

The library is not officially supporting windows (because I don't have a windows running machine, unfortunately).

KrisLau commented 2 years ago

@pmadruga Not sure if this is helpful but my roommate uses VirtualBox for as a Windows VM

Pkcarreno commented 2 years ago

Hi @pmadruga, in the case of windows it would only require skipping all the commands related to the ios folder, you could use the following function to check:

import Os from 'os'

const isMac = Os.platform() === 'darwin';

and add the isMac to the conditional of the functions related to the ios folder