Bit: Invalid or unexpected token

Created on 14 Jun 2019  ยท  4Comments  ยท  Source: teambit/bit

Description

This was partly discussed here #1718. @itaymendel Suggested that It could be an invisible char in the .bitmap file causing the error but I have validated the JSON and there seems to be no issues with it.
Here is the repo https://github.com/atto-byte/mui-daterange/tree/bit_fix and the output below shows the error

PS D:\Documents\Atto-Byte\Projects\mui-daterange> bit list
found 2 components in local scope

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ component ID                                                         โ”‚ local   โ”‚ used    โ”‚
  โ”‚                                                                      โ”‚ version โ”‚ version โ”‚
  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
  โ”‚ atto-byte.components/date-range                                      โ”‚ 0.0.6   โ”‚ 0.0.6   โ”‚
  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
  โ”‚ atto-byte.components/select                                          โ”‚ 0.0.3   โ”‚ 0.0.3   โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
PS D:\Documents\Atto-Byte\Projects\mui-daterange> bit status
Invalid or unexpected token
PS D:\Documents\Atto-Byte\Projects\mui-daterange> bit build
Invalid or unexpected token

Context and additional information

debug.log

2019-06-14T05:40:08.338Z - error: got an error from command build [id]: SyntaxError: Invalid or unexpected token. Error serialized: {"stack":"C:\\Users\\willi\\AppData\\Roaming\\npm\\node_modules\\bit-bin\\node_modules\\bit-javascript\\node_modules\\fs-extra\\lib\\empty\\index.js:1\n(function (exports, require, module, __filename, __dirname) { \n                                                              \n\nSyntaxError: Invalid or unexpected token\n    at new Script (vm.js:74:7)\n    at NativeCompileCache._moduleCompile (C:\\Users\\willi\\AppData\\Roaming\\npm\\node_modules\\bit-bin\\node_modules\\v8-compile-cache\\v8-compile-cache.js:240:18)\n    at Module._compile (C:\\Users\\willi\\AppData\\Roaming\\npm\\node_modules\\bit-bin\\node_modules\\v8-compile-cache\\v8-compile-cache.js:186:36)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)\n    at Module.load (internal/modules/cjs/loader.js:612:32)\n    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)\n    at Function.Module._load (internal/modules/cjs/loader.js:543:3)\n    at Module.require (internal/modules/cjs/loader.js:650:17)\n    at require (C:\\Users\\willi\\AppData\\Roaming\\npm\\node_modules\\bit-bin\\node_modules\\v8-compile-cache\\v8-compile-cache.js:161:20)\n    at Object.<anonymous> (C:\\Users\\willi\\AppData\\Roaming\\npm\\node_modules\\bit-bin\\node_modules\\bit-javascript\\node_modules\\fs-extra\\lib\\index.js:17:12)\n    at Module._compile (C:\\Users\\willi\\AppData\\Roaming\\npm\\node_modules\\bit-bin\\node_modules\\v8-compile-cache\\v8-compile-cache.js:192:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)\n    at Module.load (internal/modules/cjs/loader.js:612:32)\n    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)\n    at Function.Module._load (internal/modules/cjs/loader.js:543:3)\n    at Module.require (internal/modules/cjs/loader.js:650:17)","message":"Invalid or unexpected token"}
2019-06-14T05:40:08.971Z - error: [*] the command build [id] has been terminated with an error code 1
typhelp wanted

All 4 comments

@williamluke4 , I didn't get the error above. I got another error related to the compiler, which I was able to fix by deleting .bit/components directory. Once done, I get a message about "non-existing dependency files". See screenshot attached.

Screen Shot 2019-06-14 at 10 49 08 AM

I wasn't able to reproduce the error you got. I was trying also on a Windows machine.

Hi @davidfirst, Were you on the bit_fix branch?

Managed to fix this by uninstalling bit-bin and reinstalling. For those on windows be sure to use

npm install bit-bin --global --no-optional

I merge a PR https://github.com/teambit/bit/pull/1743 that removes the problematic 'posix' package, so then once released, there won't be any need to use the --no-optional flag.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shakercs picture shakercs  ยท  3Comments

m59peacemaker picture m59peacemaker  ยท  3Comments

amadeogallardo picture amadeogallardo  ยท  4Comments

JGJP picture JGJP  ยท  3Comments

itaymendel picture itaymendel  ยท  4Comments