Converting Js to Ts error cannot find module - javascript

Currently converting my project from JS to TS, working on the server side. Here is the error code.
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module
'/Users/steven/Documents/codingDojo/Mern/tomrotten/server/index.js'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain]
(internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
[nodemon] app crashed - waiting for file changes before starting...
here are a list of my dependencies:
"dependencies": {
"#material-ui/lab": "^4.0.0-alpha.58",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-session": "^1.17.1",
"jsonwebtoken": "^8.5.1",
"mysql": "^2.18.1",
"mysql2": "^2.2.5",
"sequelize": "^6.5.0",
"sqlite3": "^5.0.1"

This happens because it is missing a dependency, either because the dependency is not imported, or it is but it isn't installed. Do you have import cjr from "cjr" or something like that at the top of server/index.js? Have you done npm install?

Related

React Native iOS build release: RangeError: Maximum call stack size exceeded

I'm using react native 0.62.3 and everything worked ok yesterday.
After installing react-native-stripe-terminal package, I reverted everything, remove node_modules, Pods folders, reinstall and built to my iOS device with release scheme.
The app is installed but it crashed on the launch screen before Metro Bundle is loaded.
I tried to checkout the previous stable commit but same error.
I tried to build with release scheme in 3 mac devices but same error (debug mode is not happed anything).
Can anyone help me to know what happens with my project or have the same error or which package causes the issue? Thank you!
Here is my packages list:
"dependencies": {
"#dooboo-ui/native-switch-toggle": "^0.3.3",
"#react-native-async-storage/async-storage": "^1.15.5",
"#react-native-community/clipboard": "^1.2.2",
"#react-native-community/datetimepicker": "^2.1.0",
"#react-native-community/geolocation": "^2.0.2",
"#react-native-community/netinfo": "6.0.0",
"#react-native-community/push-notification-ios": "^1.8.0",
"#react-native-community/viewpager": "^4.0.1",
"#react-native-firebase/app": "^12.4.0",
"#react-native-firebase/auth": "^12.7.3",
"#react-native-firebase/crashlytics": "^12.4.0",
"#react-native-firebase/firestore": "^12.4.0",
"#react-native-firebase/messaging": "^12.4.0",
"#react-native-mapbox-gl/maps": "^8.2.1",
"appcenter": "4.0.0",
"appcenter-analytics": "4.0.0",
"appcenter-crashes": "4.0.0",
"axios": "^0.21.1",
"base-64": "^0.1.0",
"buffer": "^6.0.3",
"card-validator": "^6.2.0",
"dayjs": "^1.10.6",
"emoji-datasource": "^6.0.0",
"engine.io-client": "3.4.4",
"html-entities": "^1.3.1",
"lodash": "^4.17.15",
"lodash.compact": "^3.0.1",
"lodash.every": "^4.6.0",
"lodash.pick": "^4.4.0",
"lodash.values": "^4.3.0",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"react": "16.11.0",
"react-native": "0.62.3",
"react-native-autoheight-webview": "^1.5.8",
"react-native-background-timer": "^2.4.0",
"react-native-big-calendar": "^0.1.32",
"react-native-calendar-picker": "^6.1.2",
"react-native-calendars": "^1.260.0",
"react-native-camera": "^4.0.0",
"react-native-cardview": "^2.0.5",
"react-native-code-push": "^7.0.4",
"react-native-device-info": "^8.1.3",
"react-native-document-picker": "^4.1.0",
"react-native-elements": "^1.2.1",
"react-native-fast-image": "^8.3.4",
"react-native-file-viewer": "^2.0.0",
"react-native-fontawesome": "^5.7.0",
"react-native-fs": "2.15.2",
"react-native-geolocation-service": "^5.3.0-beta.3",
"react-native-gesture-handler": "^1.4.1",
"react-native-gps-state": "^2.0.3",
"react-native-highlight-words": "^1.0.1",
"react-native-hyperlink": "^0.0.19",
"react-native-i18n": "^2.0.15",
"react-native-image-crop-picker": "^0.25.3",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-image-picker": "^1.1.0",
"react-native-intercom": "13.2.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-media-controls": "^2.2.0",
"react-native-mixpanel": "^1.2.5",
"react-native-modal": "^11.5.6",
"react-native-modalbox": "^2.0.2",
"react-native-orientation-locker": "^1.3.1",
"react-native-permissions": "^2.1.1",
"react-native-popup-menu": "^0.15.9",
"react-native-progress": "^5.0.0",
"react-native-push-notification": "^7.4.0",
"react-native-qrcode-scanner": "^1.5.4",
"react-native-raw-bottom-sheet": "^2.0.2",
"react-native-reanimated": "^1.4.0",
"react-native-responsive-screen": "^1.2.2",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^2.8.0",
"react-native-signature-capture": "^0.4.10",
"react-native-signature-pad": "^0.1.0",
"react-native-slider": "^0.11.0",
"react-native-splash-screen": "^3.2.0",
"react-native-square-in-app-payments": "^1.5.0",
"react-native-svg": "^9.13.3",
"react-native-svg-transformer": "^0.14.2",
"react-native-swipe-list-view": "^3.1.0",
"react-native-vector-icons": "^7.1.0",
"react-native-video": "^5.1.1",
"react-native-view-overflow": "0.0.4",
"react-native-webview": "11.4.4",
"react-navigation": "^3.12.1",
"react-navigation-animated-switch": "^0.4.1",
"react-redux": "^7.1.1",
"reanimated-bottom-sheet": "^1.0.0-alpha.20",
"redux": "^4.0.4",
"redux-saga": "^1.1.3",
"socket.io-client": "2.4.0",
"tipsi-stripe": "^7.5.3"
},
"devDependencies": {
"#babel/core": "7.6.2",
"#babel/runtime": "7.6.2",
"#react-native-community/eslint-config": "0.0.3",
"babel-jest": "^24.9.0",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.10.1",
"eslint-config-standard": "^14.1.1",
"eslint-import-resolver-babel-module": "^5.1.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^4.0.4",
"eslint-plugin-react-native": "^3.8.1",
"eslint-plugin-standard": "^4.0.1",
"jest": "^24.9.0",
"jetifier": "^1.6.4",
"metro-react-native-babel-preset": "^0.58.0",
"prettier": "^2.0.4",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native",
"setupFiles": [
"./path/to/jestSetupFile.js"
]
}
Xcode console show this
objc[35818]: Class MGLFaux3DUserLocationAnnotationView is implemented in both /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/Frameworks/Mapbox.framework/Mapbox (0x109927f90) and /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/MyApp (0x103aa7068). One of the two will be used. Which one is undefined.
objc[35818]: Class MGLUserLocationHeadingArrowLayer is implemented in both /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/Frameworks/Mapbox.framework/Mapbox (0x109928620) and /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/MyApp (0x103aa71a8). One of the two will be used. Which one is undefined.
objc[35818]: Class MGLUserLocationHeadingBeamLayer is implemented in both /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/Frameworks/Mapbox.framework/Mapbox (0x109929520) and /private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/MyApp (0x103aa71f8). One of the two will be used. Which one is undefined.
2021-12-17 14:08:04.728837+0700 MyApp[35818:1435990] 8.0.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more.
2021-12-17 14:08:04.729565+0700 MyApp[35818:1435808] [Firebase/Crashlytics] Version 8.0.0
2021-12-17 14:08:04.913803+0700 MyApp[35818:1435808] [AppCenterCrashes] WARNING: -[MSACCrashes configureCrashReporterWithUncaughtExceptionHandlerEnabled:]/731 Detecting crashes is NOT enabled due to running the app with a debugger attached.
2021-12-17 14:08:04.933688+0700 MyApp[35818:1435808]
[CodePush] Loading JS bundle from file:///private/var/containers/Bundle/Application/9F15A17B-0A62-4055-80B0-24F845FC70CC/MyApp.app/main.jsbundle
2021-12-17 14:08:05.148221+0700 MyApp[35818:1436001] 8.0.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
firebase/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2021-12-17 14:08:05.149318+0700 MyApp[35818:1436001] 8.0.0 - [Firebase/Messaging][I-FCM002022] APNS device token not set before retrieving FCM Token for Sender ID '126625914542'. Notifications to this FCM Token will not be delivered over APNS.Be sure to re-retrieve the FCM token once the APNS device token is set.
2021-12-17 14:08:05.175 [error][tid:com.facebook.react.JavaScript] RangeError: Maximum call stack size exceeded.
2021-12-17 14:08:05.178 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
2021-12-17 14:08:05.188 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: RangeError: Maximum call stack size exceeded.
2021-12-17 14:08:05.189107+0700 MyApp[35818:1435997] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: RangeError: Maximum call stack size exceeded.', reason: 'Unhandled JS Exception: RangeError: Maximum call stack size exceeded., stack:
<unknown>#(null):(null)
v#2:1267
<unknown>#454.js:1:101
v#2:1473
<unknown>#453.js:1:127
v#2:1473
<unknown>#439.js:1:140
v#2:1473
<unknown>#405.js:1:650
v#2:1473
<unknown>#1.js:1:57
v#2:1473
d#2:875
global code#7:3
'
*** First throw call stack:
(0x181cf5c9c 0x198ea9758 0x102f365ec 0x102fb0bd0 0x102fb14f8 0x181c848d0 0x181ca05a8 0x181cd480c 0x102f650d4 0x102f67280 0x102f66ff0 0x1050e0718 0x1050e1f94 0x1050e9150 0x1050e9dd4 0x1050f54e8 0x1dbcc1e84 0x1dbcc19f0)
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
*** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: RangeError: Maximum call stack size exceeded.', reason: 'Unhandled JS Exception: RangeError: Maximum call stack size exceeded., stack:
<unknown>#(null):(null)
v#2:1267
<unknown>#454.js:1:101
v#2:1473
<unknown>#453.js:1:127
v#2:1473
<unknown>#439.js:1:140
v#2:1473
<unknown>#405.js:1:650
v#2:1473
<unknown>#1.js:1:57
v#2:1473
d#2:875
global code#7:3
'
terminating with uncaught exception of type NSException
(lldb)
Screenshot
I can't guarantee that this will solve your problem, but it might help.
Because you deleted everything, you may need to reinstall your packages.
To do that, try the following:
in your terminal, in the root of your project, run
npm i or yarn. Then
cd ios
pod install.
Then open the xcworkspace in XCode and press Command-Shift-K to do a full clean.
You can then run your iOS build task again and see if it works.
I have started to get this issue right after installing "#react-native-async-storage/async-storage" and I see thet you have this packeg also

How to configure Next.js project to use #Atlaskit open source React UI library (Compile Time Error)?

I am using Next.js version 8 with Atlaskit but getting compile time error which you see as below, I tried many bubble plugin and web-pack configs but didn't work as I am new to web-pack and bubble
/Users/UserName/Desktop/work-space/with-styled-components-app/node_modules/#atlaskit/theme/index.js:1
(function (exports, require, module, __filename, __dirname) { import { css } from 'styled-components';
^
SyntaxError: Unexpected token {
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/Desktop/work-space/with-styled-components-app/node_modules/#atlaskit/icon/cjs/components/Icon.js:30:14)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
and my package.json has these dependencies
"#atlaskit/avatar": "^15.0.1",
"#atlaskit/css-reset": "latest",
"#atlaskit/icon": "^16.0.5",
"#atlaskit/logo": "^10.0.1",
"#atlaskit/navigation-next": "5.0.1",
"#atlaskit/theme": "^8.0.1",
"#zeit/next-css": "^1.0.1",
"#zeit/next-typescript": "^1.1.1",
"apollo-boost": "^0.3.1",
"apollo-link-context": "^1.0.17",
"babel-plugin-styled-components": "^1.10.0",
"cookie": "^0.3.1",
"graphql": "^14.1.1",
"isomorphic-unfetch": "^3.0.0",
"jest-styled-components": "^7.0.0-2",
"next": "^8.0.3",
"react": "^16.8.4",
"react-apollo": "^2.5.2",
"react-dom": "^16.8.4",
"styled-components": "^4.0.0"

Cannot find module 'styled-jsx/style' in production firebase

I built a Next js app for which am trying to add some css.
Tried using the built in styled-jsx css lib . All works fine in local.
Now, when I upload the same in firebase hosting and try SSR using firebase functions . I get this error .
Question is : If styled jsx is part of next js then why am seeing this error . That too only in production
Using next js 6+ .
I know i can always add styled jsx as a dependency , but trying to understand why its not working since its supposed to be built in to next js already.
Thanks in Advance!
This is my package.json content :
"dependencies": {
"#babel/runtime": "^7.1.2",
"firebase": "^5.5.3",
"firebase-admin": "^5.12.1",
"firebase-functions": "^2.0.5",
"next": "^6.1.1",
"react": "^16.4.0",
"react-dom": "^16.4.0"
},
"devDependencies": {
"#babel/cli": "^7.1.2",
"#babel/core": "^7.1.2",
"#babel/preset-env": "^7.1.0",
"#firebase/app-types": "^0.3.2",
"cpx": "^1.5.0",
"firebase-tools": "^3.18.6",
"prettier": "^1.13.5",
"rimraf": "^2.6.2"
}
Error :
Error: Cannot find module 'styled-jsx/style'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/next/server/bundles/pages/mystatus.js:245:18)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
at Object.<anonymous> (/user_code/next/server/bundles/pages/mystatus.js:101:75)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0)
at Object.module.exports.Object.defineProperty.value (/user_code/next/server/bundles/pages/mystatus.js:89:18)
at __webpack_require__ (webpack:/webpack/bootstrap 51b5f67292a9fe79adac:21:0) code: 'MODULE_NOT_FOUND', sourceMapsApplied:

react-native start unexpected token

I'm getting an error on the start command when using react-native. The file
projectName/node_modules/#babel/core/lib/transformation/file/file.js
on line 63 is giving the error
constructor(options, {
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Module._extensions..js (module.js:417:10)
at Object.require.extensions.(anonymous function) [as .js] (/home/cread/WHOOP-ReactNative/whoopApp/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/cread/WHOOP-ReactNative/whoopApp/node_modules/#babel/core/lib/index.js:123:36)
at Module._compile (module.js:410:26)
Here is my package.json file
{
"name": *name*,
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.0-alpha.2",
"react-native": "0.54.2",
"react-native-elements": "^0.19.1",
"react-native-keyboard-aware-scroll-view": "^0.5.0",
"react-native-modal-dropdown": "^0.6.2",
"react-native-sound": "0.10.9",
"react-native-vector-icons": "^4.5.0",
"react-navigation": "^1.5.8"
},
"devDependencies": {
"babel-jest": "23.0.0-alpha.0",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.2",
"react-test-renderer": "16.3.0-alpha.2"
},
"jest": {
"preset": "react-native"
}
}
I've tried deleting my node_modules file, clearing the npm cache, and reinstalling but to no avail. The problem seems to be in the cli.js file.
I was using the last version of the react-native and nodejs. Unfortunately, I needed to go back to the version 8.11.2. In my case, it is resolved.
I removed the node_modules dir.
$ rm -rf node_modules
$ nvm install 8.11.2
$ nvm use 8.11.2
$ npm install react-native#0.54.1

Cannot read property 'Store' with RedisStore and Node.js

I'm experiencing the following error when I try to run my Node.js app:
Starting child process with 'node ./app.js'
C:\Users\Julian\OneDrive\Documents\Websites\Node\node_modules\connect-redis\lib\connect-redis.js:33
var Store = connect.session.Store;
^
TypeError: Cannot read property 'Store' of undefined
at module.exports (C:\Users\Julian\OneDrive\Documents\Websites\Node\node_modules\connect-redis\lib\connect-redis.js:33:30)
at Object.<anonymous> (C:\Users\Julian\OneDrive\Documents\Websites\Node\app.js:9:42)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
Program node ./app.js exited with code 1
Starting child process with 'node ./app.js'
Received SIGINT, killing child process...
Parent process exiting, terminating child...
Terminate batch job (Y/N)? y
My package.json file is as follows:
{
"name": "NodeChat",
"version": "0.0.0",
"main": "app.js",
"scripts": {
"stop": "echo not implemented",
"start": "supervisor ./app.js"
},
"dependencies": {
"connect-flash": "0.1.1",
"connect-redis": "1.4.7",
"cookie-parser": "1.4.3",
"ejs": "0.8.5",
"express": "4.6.1",
"express-partials": "0.2.0",
"express-session": "1.14.2",
"redis": "0.10.1"
}
}
I thought it might be a compatibility issue, but I believe I'm running a compatible version of connect-redis#1.4.7. I have an instance of Redis running.
Updating "connect-redis": "1.4.7" to 1.5.0 solved the problem for me.

Categories

Resources