Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

reactjs - How to resolve the error on 'react-native start'

  1. I just installed node.js & cli

    • installed node.js
    • installed react-native-cli

      npm -g react-native-cli
      
  2. And created a 'new project'.

    react-native init new_project
    
  3. and inside that 'new_project' directory, I tired to see if metro bundler works well.

    react-native start
    
  4. But the command gave me following error and metro is not starting. Any clue for fixing this error? (I'm using windows 10 OS.)

    • command : C:projects ew_proj>react-native start

      error Invalid regular expression: /(.fixtures.|node_modules[]react[]dist[].|website ode_modules.|heapCaptureundle.js|.ests.)$/: Unterminated character class. Run CLI with --verbose flag for more details. SyntaxError: Invalid regular expression: /(.fixtures.|node_modules[]react[]dist[].|website ode_modules.|heapCaptureundle.js|.ests.)$/: Unterminated character class at new RegExp () at blacklist (D:projects ew_proj ode_modulesmetro-configsrcdefaultslacklist.js:34:10) at getBlacklistRE (D:projects ew_proj ode_modules eact-native ode_modules@react-native-communitycliuildoolsloadMetroConfig.js:69:59) at getDefaultConfig (D:projects ew_proj ode_modules eact-native ode_modules@react-native-communitycliuildoolsloadMetroConfig.js:85:20) at load (D:projects ew_proj ode_modules eact-native ode_modules@react-native-communitycliuildoolsloadMetroConfig.js:121:25) at Object.runServer [as func] (D:projects ew_proj ode_modules eact-native ode_modules@react-native-communitycliuildcommandsserver unServer.js:82:58) at Command.handleAction (D:projects ew_proj ode_modules eact-native ode_modules@react-native-communitycliuildcliEntry.js:160:21) at Command.listener (D:projects ew_proj ode_modulescommanderindex.js:315:8) at Command.emit (events.js:210:5) at Command.parseArgs (D:projects ew_proj ode_modulescommanderindex.js:651:12)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I just got a similar error for the first time today. It appears in ode_modulesmetro-configsrcdefaultslacklist.js, there is an invalid regular expression that needed changed. I changed the first expression under sharedBlacklist from:

var sharedBlacklist = [
  /node_modules[/\]react[/\]dist[/\].*/,
  /website/node_modules/.*/,
  /heapCapture/bundle.js/,
  /.*/__tests__/.*/
];

to:

var sharedBlacklist = [
  /node_modules[/\]react[/\]dist[/\].*/,
  /website/node_modules/.*/,
  /heapCapture/bundle.js/,
  /.*/__tests__/.*/
];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...