I am using Ionic 2:
Your system information:
ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed
When I run ionic serve, I get the following error:
Typescript Error
Cannot find namespace 'firebase'.
...t/IDE/ionic-apps/theWhoZoo-chat/node_modules/angularfire2/database/database.d.ts
constructor(fbConfig: FirebaseAppConfig);
list(urlOrRef: string | firebase.database.Reference, opts?: FirebaseListFactoryOpts): FirebaseListObservable<any[]>;
object(urlOrRef: string | firebase.database.Reference, opts?: FirebaseObjectFactoryOpts): FirebaseObjectObservable<any>;
This is a new Ionic project created with ionic start ....
If anyone can suggest how I can resolve this, I would appreciate it.
I think it may be related to compatibles withing Ionic versions. The reason I say this, is because I am following this tutorial, and I guess he isn't using Ionic Framework Version: 2.0.0-rc.4. His example has an app.ts, where I split it into app.module.ts and app.component.ts as required by rc.4.
More info:
typings.json
{
"globalDependencies": {
"firebase3": "file:node_modules/angularfire2/firebase3.d.ts"
}
}
package.json
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "2.2.1",
"#angular/compiler": "2.2.1",
"#angular/compiler-cli": "2.2.1",
"#angular/core": "2.2.1",
"#angular/forms": "2.2.1",
"#angular/http": "2.2.1",
"#angular/platform-browser": "2.2.1",
"#angular/platform-browser-dynamic": "2.2.1",
"#angular/platform-server": "2.2.1",
"#ionic/storage": "1.1.7",
"angularfire2": "^2.0.0-beta.3-0930330",
"firebase": "^3.3.0",
"ionic-angular": "2.0.0-rc.4",
"ionic-native": "2.2.11",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26"
},
"devDependencies": {
"#ionic/app-scripts": "0.0.47",
"typescript": "2.0.9"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "theWhoZoo-chat: An Ionic project"
}
tsconfig.json
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5"
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
app.module.ts
import { NgModule, ErrorHandler } from '#angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { FIREBASE_PROVIDERS, defaultFirebase, AngularFire, FirebaseAuth } from 'angularfire2';
#NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [{ provide: ErrorHandler, useClass: IonicErrorHandler },
FIREBASE_PROVIDERS, defaultFirebase({
apiKey: "xxxx",
authDomain: "xxxx.firebaseapp.com",
databaseURL: "https://xxxx.firebaseio.com",
storageBucket: "xxxx.appspot.com"
})]
})
export class AppModule { }
This seems to have resolved my issue.
Adding the following to app.component.ts:
import firebase from 'firebase'
...
firebase.initializeApp({
apiKey: "",
authDomain: "baseapp.com",
databaseURL: "",
storageBucket: "",
messagingSenderId: ""
});
Related
I'm developing a vue3 project with vite.
The HMR doesn't working fine in my dev enviroment.
When a vue file edited, vite handle the change and send a message thru websocket correctly
{"type":"update",
"updates":[{"type":"js-update","timestamp":1669740364450,"path":"/src/views/user/LoginView.vue","explicitImportRequired":false,"acceptedPath":"/src/views/user/LoginView.vue"}]}
but in the browser (I tried different ones) nothing happened.
Any solution?
my package.json
{
"name": "frontendq",
"private": true,
"version": "0.9.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"#quasar/extras": "^1.15.5",
"axios": "^1.1.3",
"moment": "^2.29.4",
"quasar": "^2.10.2",
"vue": "^3.2.45",
"vue-i18n": "9",
"vue-recaptcha": "^2.0.3",
"vue-router": "^4.1.6",
"vue3-cookies": "^1.0.6",
"vuex": "^4.1.0"
},
"devDependencies": {
"#quasar/vite-plugin": "^1.2.3",
"#vitejs/plugin-vue": "^3.2.0",
"sass": "1.32.12",
"vite": "^3.2.4"
},
"packageManager": "yarn#3.2.4"
}
I've been dealing with this issue in a project with Vue 3, TypeScript and Vite 4. I added the next to my vite.config.ts to fix the hot reload:
server: {
watch: {
usePolling: true,
}
},
My entire vite.config.ts:
import {defineConfig} from "vite";
import vue from "#vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server: {
watch: {
usePolling: true,
}
},
});
I'm having an issue using pinia, Previously I used vuex on my project but I wanted to migrate to pinia to handle my store. So I think, I setup pinia properly. So I can run the serv of my application without issues. But here is what i get when i open the page (PS: The vue dev tools is not anymore detected):
Here is my file package.json:
{
"name": "ecomm-challenge",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^6.1.1",
"#fortawesome/free-regular-svg-icons": "^6.1.1",
"#fortawesome/free-solid-svg-icons": "^6.1.1",
"#fortawesome/vue-fontawesome": "^3.0.0-4",
"core-js": "^3.6.5",
"pinia": "^2.0.14",
"vue": "^3.0.0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.15",
"#vue/cli-plugin-eslint": "~4.5.15",
"#vue/cli-service": "~4.5.15",
"#vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"vue-cli-plugin-pinia": "~0.1.3"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
and here you can find my main.js file:
import { createApp } from "vue";
import App from "./App.vue";
import { library } from "#fortawesome/fontawesome-svg-core";
import { faCartShopping } from "#fortawesome/free-solid-svg-icons";
import { createPinia } from "pinia";
import { FontAwesomeIcon } from "#fortawesome/vue-fontawesome";
library.add(faCartShopping);
const pinia = createPinia();
createApp(App)
.use(pinia)
.component("font-awesome-icon", FontAwesomeIcon)
.mount("#app");
Here is my github if someone want to check the code: https://github.com/Elsong1120/Ecomm-challenge
Thanks to anyone who will help me.
Had similar issues this is what helped me:
1st create a new file in store folder \store\store.js wich looks like this:
import { createPinia, setActivePinia } from "pinia";
const pinia = createPinia();
setActivePinia(pinia);
export default pinia;
2nd import the pinia (exported from \store\store.js) into your main.js
import { createApp } from 'vue';
import pinia from './stores/store.js';
import App from './App.vue';
const app = createApp(App);
app.use(pinia)
app.mount('#app');
This question already has an answer here:
SyntaxError: Unexpected token 'export' on NextJS auth integration
(1 answer)
Closed 11 months ago.
I am trying to code-along with a vercel guide: https://vercel.com/guides/nextjs-prisma-postgres. I am getting an error Unexpected token 'export' when trying to add adapter: PrismaAdapter(prisma) to [...nextauth].ts. Per the attached image - it seems to originate in the node_modules folder inside prisma_adapter.
image of error
[...nextauth].ts:
import NextAuth from "next-auth";
import GithubProvider from "next-auth/providers/github";
import { PrismaAdapter } from "#next-auth/prisma-adapter";
import prisma from "../../../lib/prisma";
export default NextAuth({
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
],
adapter: PrismaAdapter(prisma),
secret: process.env.SECRET,
});
package.json:
{
"name": "hello-next",
"version": "1.0.0",
"description": "",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"#next-auth/prisma-adapter": "^1.0.2",
"#prisma/client": "^3.11.0",
"next": "12.0.10",
"next-auth": "^4.3.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-markdown": "8.0.0"
},
"devDependencies": {
"#types/node": "^17.0.14",
"#types/react": "17.0.38",
"prisma": "^3.11.0",
"ts-node": "^10.7.0",
"typescript": "^4.5.5"
}
}
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "lib/prisma.tsx"]
}
this is a bug in the latest #next-auth/prisma-adapter version, downgrading to 1.0.1 is the only workaround for the moment.
This issue is caused by a recent release of next-auth. The only option is to downgrade as of now as mentioned in this GitHub Issue.
Root cause of this was caused by changing the outputs to ESM.
so I started my app and Im trying to use CSS for my React Components, I included my css rules in the webpack file:
This is the file structure:
The error that I get is :
ERROR in ./client/src/related_items/styles/Card.css 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> .Card-Component {
| border: 1px solid black;
| }
# ./client/src/related_items/Card.jsx 2:0-27
# ./client/src/related_items/App.jsx 2:0-26 8:163-167
# ./client/src/App.jsx 26:0-51 78:43-55
# ./client/src/index.js 3:0-28 4:50-53
webpack 5.52.0 compiled with 1 error in 13 ms
webpack.config.js
const path = require('path');
const SRC_DIR = path.join(__dirname, 'client', 'src');
const OUT_DIR = path.join(__dirname, 'client', 'dist');
module.exports = {
mode: 'development',
entry: path.join(SRC_DIR, 'index.js'),
output: {
path: OUT_DIR,
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
]
},
resolve: {
extensions: ['.js', '.jsx']
},
};
Im simply trying to use CSS in a component:
Card Component
import React from 'react';
import './styles/Card.css';
const Card = () => {
return (
<div className="Card-Component">
<h1>This is a Card</h1>
</div>
)
}
export default Card;
This is my CSS:
.Card-Component {
border: 1px solid black;
}
This is my package.json
{
"name": "front-end-capstone",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"react-dev": "webpack -w",
"server-dev": "nodemon server/index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#babel/core": "^7.15.5",
"#babel/preset-env": "^7.15.4",
"#babel/preset-react": "^7.14.5",
"axios": "^0.21.4",
"babel-loader": "^8.2.2",
"babel-preset-es2015": "^6.24.1",
"chai": "^4.3.4",
"css-loader": "^6.2.0",
"express": "^4.17.1",
"http-proxy-middleware": "^2.0.1",
"jest": "^27.1.1",
"mocha": "^9.1.1",
"nodemon": "^2.0.12",
"path": "^0.12.7",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"sass": "^1.39.0",
"sass-loader": "^12.1.0",
"style-loader": "^3.2.1",
"webpack": "^5.52.0",
"webpack-cli": "^4.8.0"
}
}
Just killed webpack and re run it again, thought that having in in watch mode would do it
I am trying to use FCM Cordova plugin to implement Push notifications. However I am facing this weird issue.
I followed this URL https://ionicframework.com/docs/native/fcm/ and installed it and also imported it correctly in app.component.ts(this where I am trying to use ) and app.module.ts
This is my app.module.ts
import { NgModule, ErrorHandler } from '#angular/core';
import { BrowserModule } from '#angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import {Facebook} from 'ionic-native';
import { StudentPage } from '../pages/student/student';
import { ContactPage } from '../pages/contact/contact';
import { TutorPage } from '../pages/tutor/tutor';
import { TabsPage } from '../pages/tabs/tabs';
import { LoginPage } from '../pages/login/login';
import { ProfilePage } from '../pages/profile/profile';
import { ChatPage } from '../pages/chat/chat';
import { UserChatPage } from '../pages/userchat/userchat';
import { NativeStorage } from '#ionic-native/native-storage';
import { StatusBar } from '#ionic-native/status-bar';
import { SplashScreen } from '#ionic-native/splash-screen';
import { GooglePlus } from '#ionic-native/google-plus';
import { IntroPage } from '../pages/intro/intro';
import { NotifyPage } from '../pages/notification/notification';
import { FCM } from '#ionic-native/fcm';
#NgModule({
declarations: [
ClassetteApp,
StudentPage,
ContactPage,
TutorPage,
TabsPage,
LoginPage,
ProfilePage,
ChatPage,
IntroPage,
UserChatPage,
NotifyPage,
FCM
],
imports: [
BrowserModule,
IonicModule.forRoot(ClassetteApp,{tabsPlacement:'top',tabsLayout:'icon-right',tabsHideOnSubPages:true})
],
bootstrap: [IonicApp],
entryComponents: [
ClassetteApp,
StudentPage,
ContactPage,
TutorPage,
TabsPage,
LoginPage,
ProfilePage,
ChatPage,
IntroPage,
UserChatPage,
NotifyPage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
Facebook,
NativeStorage,
GooglePlus,
FCM
]
})
export class AppModule {}
this my package.json
{
"name": "myapp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"start": "node ./bin/www"
},
"dependencies": {
"#angular/common": "4.1.2",
"#angular/compiler": "4.1.2",
"#angular/compiler-cli": "4.1.2",
"#angular/core": "4.1.2",
"#angular/forms": "4.1.2",
"#angular/http": "4.1.2",
"#angular/platform-browser": "4.1.2",
"#angular/platform-browser-dynamic": "4.1.2",
"#ionic-native/core": "3.10.2",
"#ionic-native/facebook": "^3.10.2",
"#ionic-native/fcm": "^4.1.0",
"#ionic-native/google-plus": "^3.12.1",
"#ionic-native/native-storage": "^3.10.3",
"#ionic-native/splash-screen": "3.10.2",
"#ionic-native/status-bar": "3.10.2",
"#ionic/storage": "2.0.1",
"body-parser": "^1.17.2",
"cordova-android": "^6.2.3",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-facebook4": "^1.9.0",
"cordova-plugin-fcm": "^2.1.2",
"cordova-plugin-googleplus": "^5.1.1",
"cordova-plugin-nativestorage": "^2.2.2",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"express": "^4.15.3",
"ionic-angular": "3.3.0",
"ionic-native": "^2.5.1",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"mongoose": "^4.11.4",
"morgan": "^1.8.2",
"rxjs": "5.1.1",
"serve-favicon": "^2.4.3",
"socket.io": "^2.0.3",
"socket.io-client": "^2.0.3",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.11"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.7",
"#ionic/cli-plugin-cordova": "1.6.2",
"#ionic/cli-plugin-ionic-angular": "1.4.1",
"ionic": "3.7.0",
"typescript": "2.3.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-facebook4": {
"APP_ID": "3xxxxxxxx75862",
"APP_NAME": "myapp"
},
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "4xsdsdxxxxxxx7dsgct91usuntkmomme1n8rq5i7oipq8.apps.googleusercontent.com"
},
"cordova-plugin-fcm": {}
},
"platforms": [
"android"
]
},
"main": "index.js",
"keywords": [
"server"
],
"license": "ISC"
}
Note: I have tried adding FCM under imports in app.module.ts but then I get a different error
Unexpected value 'FCM' imported by the module 'AppModule'. Please add
a #NgModule annotation.
You don't need to import FCM to declarations array, in there you'll only declare modules (like pages, pipes, services, and more). All plugins must be declared only in providers.