itinance / itinance/react-native-fs

unexpected syntax error coming in react-native-fs

Open
#1,134 2 comments 6 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

**Error**
When importing `react-native-fs` in a react component, like this
```js
import RNFS from 'react-native-fs';
```
It automatically generates the following errors without doing anything else
```cmd
X [ERROR] Expected ")" but found ":"

node_modules/react-native-fs/FS.common.js:30:29:
30 │ var normalizeFilePath = (path: string) => (path.startsWith('file://') ? path.slice(7) : path);
│ ^
╵ )

9:31:53 am [vite] error while updating dependencies:
Error: Build failed with 1 error:
node_modules/react-native-fs/FS.common.js:30:29: ERROR: Expected ")" but found ":"
at failureErrorWithLog (C:\Users\ASC\Documents\GitHub\board-scanner\view\node_modules\esbuild\lib\main.js:1566:15)
at C:\Users\ASC\Documents\GitHub\board-scanner\view\node_modules\esbuild\lib\main.js:1024:28
at runOnEndCallbacks (C:\Users\ASC\Documents\GitHub\board-scanner\view\node_modules\esbuild\lib\main.js:1438:61)
at buildResponseToResult (C:\Users\ASC\Documents\GitHub\board-scanner\view\node_modules\esbuild\lib\main.js:1022:7)
at C:\Users\ASC\Documents\GitHub\board-scanner\view\node_modules\esbuild\lib\main.js:1134:14
at responseCallbacks. (C:\Users\ASC\Documents\GitHub\board-scanner\view\node_modules\esbuild\lib\main.js:671:9)
at handleIncomingPacket (C:\Users\ASC\Documents\GitHub\board-scanner\view\node_modules\esbuild\lib\main.js:726:9)
at Socket.readFromStdout (C:\Users\ASC\Documents\GitHub\board-scanner\view\node_modules\esbuild\lib\main.js:647:7)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:199:23)
```

**Steps to Reproduce**
- Import `react-native-fs` using the command `import RNFS from 'react-native-fs';` in your react component

**Images**
![image](https://user-images.githubusercontent.com/71203637/193732352-eabedd89-a512-47d5-ace9-6157bbc7dbe0.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.