react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Error in react-packager

Open saveliy-kremen opened this issue 10 years ago • 15 comments

Error in react-native/packager/react-packager/src/Server/index.js :653 SyntaxError: Unexpected token )

saveliy-kremen avatar Jul 19 '16 14:07 saveliy-kremen

which version of RN are u using?

KGALLET avatar Jul 20 '16 06:07 KGALLET

last

saveliy-kremen avatar Jul 20 '16 08:07 saveliy-kremen

My guess is that you're using an old version of Node. Try installing nvm and running:

nvm install 6
nvm alias default node

ide avatar Jul 20 '16 09:07 ide

The error persists: Error in react-native/packager/react-packager/src/Server/index.js :623 SyntaxError: Unexpected token )

saveliy-kremen avatar Jul 20 '16 10:07 saveliy-kremen

My guess is that extra comma https://github.com/facebook/react-native/blob/master/packager/react-packager/src/Server/index.js :line 652

saveliy-kremen avatar Jul 20 '16 12:07 saveliy-kremen

Maybe a bad babel config somewhere then?

ide avatar Jul 20 '16 22:07 ide

I do not know. I'm trying to do everything on the instructions on Win7: choco install nodejs.install choco install python2 npm install -g react-native-cli react-native init Project

D:\Локальные проекты\React\Native\Project\node_modules\react-native\packager\react-packager\src\Server\index.js:623 ), ^ SyntaxError: Unexpected token ) at Object.exports.runInThisContext (vm.js:76:16) at Module._compile (module.js:513:28) at Module._extensions..js (module.js:550:10) at Object.require.extensions.(anonymous function) [as .js](D:Локальные проектыReactNativeProjectnode_modulesbabel-registerlibnode.js:166:7) at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module._load (module.js:409:3) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at Object. (D:\Локальные проекты\React\Native\Project\node_modules\react-native\local-cli\bundle\buildBundle.js:17:16)

saveliy-kremen avatar Jul 21 '16 07:07 saveliy-kremen

Please share output of node --version and ls -all when run from within the root folder of your project.

grabbou avatar Jul 29 '16 19:07 grabbou

node --version v6.4.0

ls -all

total 165
drwxr-xr-x 1 Administratör 197121   0 Aug 27 20:54 ./
drwxr-xr-x 1 Administratör 197121   0 Aug 27 20:44 ../
drwxr-xr-x 1 Administratör 197121   0 Aug 27 20:54 node_modules/
-rw-r--r-- 1 Administratör 197121 207 Aug 27 20:54 package.json

This is the output I get when I "react-native init"

This will walk you through creating a new React Native project in C:\Users\Administratör.WINDOWS-J9P7RTI\Documents\Programmering\knuffa
Installing react-native package from npm...
C:\Users\Administratör.WINDOWS-J9P7RTI\Documents\Programmering\knuffa\node_modules\react-native\packager\react-packager\src\node-haste\FileWatcher\index.js:118
    );
    ^
SyntaxError: Unexpected token )
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at Module._extensions..js (module.js:565:10)
    at Object.require.extensions.(anonymous function) [as .js] (C:\Users\Administratör.WINDOWS-J9P7RTI\Documents\Programmering\knuffa\node_modules\babel-register\lib\node.js:154:7)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Administratör.WINDOWS-J9P7RTI\Documents\Programmering\knuffa\node_modules\react-native\packager\react-packager\src\node-haste\index.js:13:21)

I have the exact error, followed the setup guide on the official website.

swe-jack avatar Aug 27 '16 19:08 swe-jack

@jackbillstrom which version of npm?

rozele avatar Aug 29 '16 13:08 rozele

@rozele Currently running NPM 3.10.7.

swe-jack avatar Aug 29 '16 13:08 swe-jack

@kittens @ide @grabbou Any help? Seen the error on Stackoverflow but no answers on those questions. Will become insane without RN :(

swe-jack avatar Sep 01 '16 00:09 swe-jack

Same error in https://github.com/facebook/react-native/issues/10033

localhosted avatar Sep 28 '16 15:09 localhosted

Hey, without being able to reproduce this I don't think we can make progress here. I think we would need more information, specifically a way to reproduce this bug consistently on a new setup. I am going to close this issue but if you do have enough information to reproduce it then feel free to open a new issue.

lacker avatar Oct 25 '16 01:10 lacker

@lacker I was able to reproduce this consistently by creating a directory name with non-ASCII characters, but either way I think leaving #10154 open should cover the majority of these issues. The babel-core change was already made, we just have to wait for a new release and take the upgrade here.

rozele avatar Oct 25 '16 01:10 rozele