trying to use tipsi-twitter in snack.expo.io? - react-native

I'm trying to use tipsi-twitter in snack.expo.io but I'm running into issues. I added the following item into package.json dependencies:
"tipsi-twitter": "*"
Expo then appeared to successfully install this package. In my App.js I included the following import:
import TwitterAuth from 'tipsi-twitter';
The import compiles successfully but when I put the following code after the imports:
TwitterAuth.init({
twitter_key: '<TWITTER_KEY>',
twitter_secret: '<TWITTER_SECRET>',
})
This returns an error of:
"Cannot read property 'init' of undefined"
But this appears to be the exact implementation in the Usage section of the tipsi-twitter github page:
https://github.com/tipsi/tipsi-twitter#usage
Any idea what the issue might be or how to debug? Am I possibly missing some type of configuration step or is it possible that expo.io doesn't support this package/scenario?

Related

Unable to import a npm module I downloaded

I'm running a SvelteKit application with the Animate on Scroll (aos) module. This worked like a charm but due to the nature of my project, I needed to modify a few lines in the module, so I pulled the project from GitHub, modified it, rebuilt it and imported it via a local dependency:
"dependencies": {
"aos": "file:/path/to/aos"
}
Whenever I try to import the module now however: import AOS from 'aos';, I get this error message:
Uncaught (in promise) SyntaxError: The requested module '/#fs/C:/path/to/aos/dist/aos.js' does not provide an export named 'default'
Note that this also happens when I pull the repository and try to import it locally without changing it. Why does this happen and how can I fix it?

Vue Cli remote preset crashes on Invoking Generators

i'm trying to create a remote vue cli preset on github, but for some reason i keep getting a syntax error.
My preset repo: https://github.com/christoph-schaeffer/vue-preset
The command i have entered: vue create --preset christoph-schaeffer/vue-preset testProject
The Error i get:
🚀 Invoking generators...
ERROR SyntaxError: Identifier 'router' has already been declared (15:7)
SyntaxError: Identifier 'router' has already been declared (15:7)
at Object._raise (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:762:17)
at Object.raiseWithData (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:755:17)
at Object.raise (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:749:17)
at ScopeHandler.checkRedeclarationInScope (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:4826:12)
at ScopeHandler.declareName (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:4792:12)
at Object.checkLVal (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:9367:22)
at Object.checkLVal (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:865:15)
at Object.parseImportSpecifierLocal (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:12706:10)
at Object.maybeParseDefaultImportSpecifier (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:12751:12)
at Object.parseImport (/usr/local/lib/node_modules/#vue/cli/node_modules/#babel/parser/lib/index.js:12677:31)
At first it worked fine, then i've added several things in the preset.json along with a generator template.
After getting the error i've tried reverting the whole repo to the state it had when it was still working. However i still get that error...
I guess it's not really about the preset but instead an issue with my global babel package or something?
I'm using vue-cli version 4 and im working on a mac
Any directions on how i could get this running would be highly appreciated
I've found the issue.
First: the vue cli somehow seems to cache remote presets. That's the reason why it didn't work even after reverting changes.
The actual issue was, that the main.js shouldn't be changed like the other template files and needs special attention. For some weird reason it gives those random errors as soon as you have a main.js in your template.
If anyone is curious on how to modify your main.js in a preset check out :
https://cli.vuejs.org/dev-guide/plugin-dev.html#changing-main-file

Angular flex-layout in Ionic3... rxjs/operator not found?

Trying to use #angular/flex-layout in an existing npm-enabled Ionic 3 project.
Adding "FlexLayoutModule" to my main module's imports won't allow the app to start, saying that: cannot find module "rxjs/operators" is the cause.
Already cleared node_module, npm install, reinstalled Ionic CLI. Nothing helps. Could it be a version conflict? Moreover, I'm already using Observables in this project. I don't get it. And the import of "FlexLayoutModule" is in cause of this issue (disabling the import removes the issue).
Anyone could be successful at using flex-layout with ionic? I've seen this plunk, but it uses system.js, so not 100% reproducing my goal.
http://plnkr.co/edit/y8R0MF?p=info
Edit: a more verbose issue:
Uncaught (in promise): Error: Cannot find module "rxjs/operators"
Error: Cannot find module "rxjs/operators" at Object.580
(http://localhost:8100/build/22.main.js:319:7) at webpack_require
(http://localhost:8100/build/main.js:48:30) at Object.1021
(http://localhost:8100/build/22.main.js:11:79) at webpack_require
(http://localhost:8100/build/main.js:48:30) at
http://localhost:8100/build/main.js:122015:10 at t.invoke
(http://localhost:8100/build/polyfills.js:3:9283) at Object.onInvoke
(http://localhost:8100/build/main.js:4650:37) at t.invoke
(http://localhost:8100/build/polyfills.js:3:9223) at r.run
(http://localhost:8100/build/polyfills.js:3:4452) at
http://localhost:8100/build/polyfills.js:3:14076
I'm getting a similar error with Angular CLI. Everything is OK until I include FlexLayoutModule in the app's NgModule imports. Then I get the error:
Module not found: Error: Can't resolve 'rxjs/operators' in 'D:\dev\Vms.Signup.Client\node_modules\#angular\flex-layout\esm5'
I updated to the latest rxjs and that seems to have fixed it.

aurelia - error using material-components-web with skelton-esnext project

I've successfully used the material-components-web library from within my aurelia skeleton-esnext-webpack projects but I am strugling to get them working in a skeleton-esnext project.
The problem seems to be with the fact that the skeleton-esnext project uses jspm with system.js as its module loader.
I have added "#material/textfield": "npm:#material/textfield#^0.3.6" to the jspm dependencies section of my package.json which seems to install the correct #material libraries to my jspm_modules/npm/#material.
Now, when I try to access any class from this library from within any my aurelia view models
import {MDCTextfieldFoundation} from '#material/textfield';
I get the following error in the browser when I run the project:
Error: (SystemJS) Unexpected token import
SyntaxError: Unexpected token import
at eval (<anonymous>)
at Object.eval (http://localhost:9000/jspm_packages/npm/#material/textfield#0.3.6.js:1:123)
at eval (....
Any suggestions to whats most likely causing this issue?
SystemJS is importing the raw source file of the plugin instead of the transpiled one (you can see this if you look into jspm_packages/npm/#material/textfield#0.3.6.js.
You can fix it by changing the location in there to point to the dist directory of the directory textfield#0.3.6. However, it gets overriden all the time on potential updates. And it is not saved in CVS.
Another, more simpler approach, would be to import the correct file in your view model:
import {MDCTextfieldFoundation} from '#material/textfield/dist/mdc.textfield';

"Unable to resolve module path" in React Native

After adding a new dependency, I get the error message "Unable to resolve module path" in a red screen in my React Native app. I've tried clearing the cache as the screen instructs.
(question is brief as I'm answering it myself)
The error message:
Unable to resolve module path
Should really be:
Unable to resolve module "path"
path is the name of the module it can't load! I was reading the error message as "can't resolve a path to the module".
So the root cause is, the file it lists in the error message is importing the native Node module path, which isn't available on React Native.
The solution is to npm install -D path, which is a replica implementation.
Any imports from #babel/core package is causing this error.
Some code editors are inserting the import line automatically.
For example, import { types } from '#babel/core' is inserted by Visual Studio Code when you enter types.
If you remove the imports from #babel/core in the codes, it will be fixed.
Quote from chronikum on react-native github issues for future readers
Just check if you somewhere accidentally imported something from
#babel/core.
Here is the original link
https://github.com/facebook/react-native/issues/27522#issuecomment-568306279
None of the answers are really helpful, I found that the problem in my case was that the macros plugin was missing in my babel configuration file.
This is what I had in my babel.config.js
module.exports = {
presets: ["module:metro-react-native-babel-preset"],
};
After adding the macros plugin
module.exports = {
plugins: ["macros"],
presets: ["module:metro-react-native-babel-preset"],
};
If you get this error, most like you are missing a plugin in your babel config.
I have solved my issue by the below steps.
Read the error message carefully, the error is node modules path(mentioned as NO: 1 in below image). In my case, I have the "just-cli/" module (Mentioned NO: 2).
search the module (just-cli) you have imported somewhere in your project and just Remove it. The problem will be solved.