question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restricted in strict mode, js engine: hermes

See original GitHub issue

Description

After updating to RN 0.70.2 I started getting this error:

Error: Requiring module "src/api/Api.js", which threw an exception: TypeError: Restricted in strict mode, js engine: hermes

Version

0.70.2

Output of npx react-native info

System: OS: macOS 12.6 CPU: (8) x64 Intel® Core™ i7-1068NG7 CPU @ 2.30GHz Memory: 73.93 MB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.17.0 - /usr/local/opt/node@16/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.15.0 - /usr/local/opt/node@16/bin/npm Watchman: 2022.10.03.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: API Levels: 25, 26, 27, 28, 29, 30, 31, 33 Build Tools: 30.0.3, 31.0.0, 33.0.0 Android NDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild Languages: Java: 14.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.70.2 => 0.70.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

Import a function.

Snack, code example, screenshot, or link to a repository

import { logout } from './api/Api';

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

26reactions
denialfarizi1commented, Nov 4, 2022

downgrade axios to axios ^0.27.2 and npm start – --reset-cache

17reactions
tapzcommented, Oct 5, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native: SyntaxError: Strict mode does not allow function ...
This error happens because babel now adds 'use strict' to all modules. And it doesn't allow defining a function inside a lexical block...
Read more >
error typeerror: restricted in strict mode, js engine: hermes
4), when I import the axios (version 1.0.0 and above) from the axios module I get this error message: 'TypeError: Restricted in strict...
Read more >
Strict mode - JavaScript - MDN Web Docs
JavaScript's strict mode is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
Read more >
Getting Restricted Mode Error when using axios in react - Reddit
Requiring Module "node_modules/axios/index.js", which threw an exception : TypeError : Restricted in strict mode.
Read more >
Strict Mode - React
StrictMode is a tool for highlighting potential problems in an application. Like Fragment , StrictMode does not render any visible UI.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found