Manifest (app.json) not initialized | Expo - javascript

I am trying to implement expo push notification for a chat app so by following the Documentation I reached a part where I need to run the following command : expo push:android:upload --api-key your-token-here . So I went and got the token from firebase and after running the command I get an error saying Manifest (app.json) not initialized. I guess the problem comes from the fact that I am using a dynamic config (app.config.js). How could I fix it ?
app.config.js
import "dotenv/config";
export default {
expo: {
name: "XXX",
slug: "XXX",
version: "1.0.0",
scheme: "com.XXXXXXXXX.XXXX",
orientation: "portrait",
icon: "./assets/icon.png",
userInterfaceStyle: "light",
splash: {
image: "./assets/splash.png",
resizeMode: "contain",
backgroundColor: "#ffffff",
},
updates: {
fallbackToCacheTimeout: 0,
},
assetBundlePatterns: ["**/*"],
ios: {
supportsTablet: true,
},
android: {
package: "com.XXXXXXXXX.XXXX",
googleServicesFile: "./google-services.json",
adaptiveIcon: {
foregroundImage: "./assets/adaptive-icon.png",
backgroundColor: "#FFFFFF",
},
},
web: {
favicon: "./assets/favicon.png",
},
extra: {
apiKey: process.env.API_KEY,
authDomain: process.env.AUTH_DOMAIN,
projectId: process.env.PROJECT_ID,
storageBucket: process.env.STORAGE_BUCKET,
messagingSenderId: process.env.MESSAGING_SENDER_ID,
appId: process.env.APP_ID,
measurementId: process.env.MEASUREMENT_ID,
oneSignalAppId: process.env.ONESIGNAL_APP_ID,
},
plugins: [
[
"expo-image-picker",
{
photosPermission:
"The app accesses your photos to let you share them with your friends.",
},
],
],
},
};

I wonder if you used the dynamic config before this change? It's hard to say for sure, but looking quickly through the config you posted, I believe you are not expected to have the expo key in the dynamic config.
Take a look at config docs, the static configs do have the structure with expo:
// app.json content
{
"expo": {
"name": "My app",
"slug": "my-app"
}
}
But when you look at the dynamic one, everything's flattened to the top level:
// app.config.js content
module.exports = {
"name": "My app",
"slug": "my-app"
};
If it doesn't help, I'd suggest running expo config to see the introspected resulting config that Expo sees.

Related

CombinedError: [GraphQL] Experience with id doesn't exist

I am using dynamic configuration for my expo app and it seems that, that's causing some problem when trying to expo build. I have linked the expo project correctly to the eas project and upon running any command that start with expo build I am thrown the following error :
CombinedError: [GraphQL] Experience with id 'xxx-1xxx-4xxx-bx-baxxxfc' does not exist.
I suspect my app.config.json is the problem but I have no idea on how to fix it
import "dotenv/config";
export default {
expo: {
name: "LetsChat",
slug: "LetsChat",
version: "1.0.0",
scheme: "com.bertdelaspeed.letschat",
orientation: "portrait",
icon: "./assets/icon.png",
userInterfaceStyle: "light",
splash: {
image: "./assets/splash.png",
resizeMode: "contain",
backgroundColor: "#ffffff",
},
updates: {
fallbackToCacheTimeout: 0,
},
assetBundlePatterns: ["**/*"],
ios: {
supportsTablet: true,
},
android: {
package: "com.bertdelaspeed.letschat",
googleServicesFile: "./google-services.json",
adaptiveIcon: {
foregroundImage: "./assets/adaptive-icon.png",
backgroundColor: "#FFFFFF",
},
},
web: {
favicon: "./assets/favicon.png",
},
extra: {
apiKey: process.env.API_KEY,
authDomain: process.env.AUTH_DOMAIN,
projectId: process.env.PROJECT_ID,
storageBucket: process.env.STORAGE_BUCKET,
messagingSenderId: process.env.MESSAGING_SENDER_ID,
appId: process.env.APP_ID,
measurementId: process.env.MEASUREMENT_ID,
eas: {
projectId: "xxx-1xxx-4xxx-bx-baxxxfc",
},
},
plugins: [
[
"expo-image-picker",
{
photosPermission:
"The app accesses your photos to let you share them with your friends.",
},
],
],
},
};
You may need to change the project id field in your app.json under extra.eas.projectId - it appears to somehow be set to an incorrect value
You will get the product id from app.json under Extra --> eas --> ProjectID

Nodejs Swagger 2.0 No operations defined in spec! on dist

I defined the swagger option below:
const swaggerDocOptions = { explorer: true, definition: {
swagger: '2.0',
components: {},
info: {
title: 'Document API',
version: '1.0.0',
description: 'document API',
},
schemes: [
'http',
'https',
],
security: [{
simple: [],
}],
securityDefinitions: {
simple: {
type: 'basic',
},
}, }, basedir: `${__dirname}`, apis: [
`${__dirname}\\routes\\*.js`, ], };
const specs = swaggerJsDoc(swaggerDocOptions);
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(specs));
The Api doc can display successfully when I run on my local
And then I try to deploy to server with bytenote
and the __dirname = app/dist on server, but the Api doc does not display
Could you advise, what is wrong here?

Nuxt/ESLint - Parsing error: Must use import to load ES Module

I am using Nuxt 2.15.7 in VS Code, using Node version 14.17.1 and the eslint extension.
The problem
I started seeing a red squiggly line under the 1st character of every file. When hovering over it, this is the error I see:
require() of ES modules is not supported.
require() of C:\Users\SR Gears\Documents\work\my-website\node_modules\eslint\node_modules\eslint-scope\lib\definition.js
from C:\Users\SR Gears\Documents\work\my-website\node_modules\babel-eslint\lib\require-from-eslint.js
is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename definition.js to end in .cjs,
change the requiring code to use import(),
or remove "type": "module" from
C:\Users\SR Gears\Documents\work\my-website\node_modules\eslint\node_modules\eslint-scope\package.json.eslint
What I have tried so far
First, I tried renaming the appropriate files as listed above in the error, and restarting the eslint server, but the error remains.
So, I went over to the eslint extension in VS Code and read the following:
The approval flow to allow the execution of a ESLint library got reworked. Its initial experience is now as follows:
- no modal dialog is shown when the ESLint extension tries to load an ESLint library for the first time and an approval is necessary. Instead the ESLint status bar item changes to ESLint status icon indicating that the execution is currently block.
- if the active text editor content would be validated using ESLint, a problem at the top of the file is shown in addition.
The execution of the ESLint library can be denied or approved using the following gestures:
- clicking on the status bar icon
- using the quick fix for the corresponding ESLint problem
- executing the command ESLint: Manage Library Execution from the command palette
Okay, so I tried the above suggestions:
clicking on the status bar icon (it isn't there in my status bar)
using the quick fix for the corresponding ESLint problem (shows no quick fix available)
executing the command ESLint: Manage Library Execution from the command palette (I get a message that this request is unknown)
Potential Fix with error
So, I navigated over to eslintrc.js I hovered over module.exports = { on line 1, and got the lightbulb icon show. The Quick Fix says Convert to ES6 module. When I click this, the file is updated. All variable keys within the options are updated to have export in front of them. This does remove the error line at the top of the files, but gives a new error for export const extends: [] variable:
'extends' is not allowed as a variable declaration name.. My eslintrc.js file (before updating to ES6 module) is here:
eslintrc.js
module.exports = {
root: true,
env: {
browser: true,
node: true
},
parserOptions: {
parser: 'babel-eslint'
},
extends: [
'plugin:nuxt/recommended',
'plugin:vue/recommended',
'eslint:recommended',
// 'prettier/vue',
'plugin:prettier/recommended'
],
globals: {
$nuxt: true,
page: true,
browser: true,
context: true,
jestPuppeteer: true
},
plugins: ['nuxt', 'vue', 'prettier'],
rules: {
'new-cap': 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/component-name-in-template-casing': ['off', 'PascalCase'],
'vue/attribute-hyphenation': ['warn'],
'vue/no-unused-components': ['warn'],
'vue/html-self-closing': [
'error',
{
html: {
void: 'any',
normal: 'always',
component: 'always'
},
svg: 'always',
math: 'always'
}
],
'vue/max-attributes-per-line': 'off',
'vue/no-v-html': 'off',
'no-unused-vars': ['warn'],
eqeqeq: ['warn'],
'no-lonely-if': ['warn'],
'require-await': ['warn'],
'handle-callback-err': ['warn'],
'space-before-function-paren': 0
}
}
One other potential fix - but not for me
For anyone else with the same errors, there is a fix here, (that also worked for me): ESlint - Error: Must use import to load ES Module `
I cannot use this fix though, as my team suggested that adjusting babel settings can create errors elsewhere.
As that cannot be my solution, would anyone else know how to manage this error? Here is my nuxt.config file. If you need to see something else, I can update it here too.
nuxt.config
import { storyblokConfig, localeMessages } from './config'
export default {
// Target: https://go.nuxtjs.dev/config-target
target: 'server',
ssr: true,
dev: false,
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: '',
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' }
],
link: [
{
rel: 'icon',
sizes: '192x192',
href: '/favicon/android-chrome-192x192.png'
},
{
rel: 'icon',
sizes: '512x512',
href: '/favicon/android-chrome-512x512.png'
},
{
rel: 'apple-touch-icon',
sizes: '180x180',
href: '/favicon/apple-touch-icon.png'
},
{ rel: 'icon', sizes: '16x16', href: '/favicon/favicon-16x16.png' },
{ rel: 'icon', sizes: '32x32', href: '/favicon/favicon-32x32.png' },
{ rel: 'icon', type: 'image/x-icon', href: '/favicon/favicon.ico' },
{ rel: 'manifest', href: '/favicon/site.webmanifest' }
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'~assets/styles/main.css',
'~assets/fonts/fabrikat/stylesheet.css',
'~assets/fonts/pangram/stylesheet.css'
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
{ src: '~/plugins/logger.js' },
{ src: '~/plugins/nujek-ui.js' },
{ src: '~/plugins/validation.js' },
{ src: '~/plugins/utils.js' },
{ src: '~/plugins/vue-tailwind.js' },
{ src: '~/plugins/rich-text-renderer.js' },
{ src: '~/plugins/defaultButton.js' }
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: [{ path: '~/components', pathPrefix: false, prefix: '' }],
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/eslint
'#nuxtjs/eslint-module',
// https://go.nuxtjs.dev/tailwindcss
'#nuxtjs/tailwindcss',
'#nuxtjs/composition-api/module',
'#nuxtjs/tailwindcss',
[
'#nujek/ui',
{
withConsole: true,
storeTemplates: {
nav: true
}
}
],
['#nujek/storyblok']
],
nujekStoryblok: {
storyblokConfig,
withConsole: false,
debug: true
},
// Modules: https://go.nuxtjs.dev/config-modules
modules: ['nuxt-i18n', '~/modules/nuxt-storyblok-queries/lib/module.js'],
storyblokQueries: storyblokConfig,
i18n: {
locales: [
{
code: 'en',
iso: 'en-US'
},
{
code: 'de',
iso: 'de-DE'
}
],
defaultLocale: 'de',
strategy: 'prefix_except_default',
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root'
},
vueI18n: {
fallbackLocale: 'de',
silentTranslationWarn: true,
messages: localeMessages
},
vuex: {
syncLocale: true,
syncMessages: true
}
},
// publicRuntimeConfig: {
// accessToken: process.env.SB_CLIENT_ACCESS_TOKEN
// },
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
transpile: ['vee-validate', '#marvr/storyblok-rich-text-vue-renderer']
}
}
c:/users/user/AppData/Roaming/Code/User/settings.json
{
"workbench.colorTheme": "Default Dark+",
"terminal.integrated.defaultProfile.windows": "Git Bash",
"editor.wordWrap": "on",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript"]
}
I met this error today on a fresh installation of nuxt.
It would npm run dev fine on the first time, but whenever I changed a file, the hot reloading would give an eslint error, as if trying to lint my eslint files.
I solved it by updating Nodejs and npm to their latest version and creating a new nuxt app.
It's probably not the answer you've been looking for, but maybe it will help others.

TypeError ERR_UNESCAPED_CHARACTERS on testing Vue project using Nightwatch

I have a problem trying to setup my Nightwatch environment with Vue CLI. At this point, I just want to make it work with Chrome (we'll see for Firefox soon) but when I run a simple test, It doesn't work.
Here is my test file:
module.exports = {
'default e2e tests': browser => {
browser
.url("http://localhost:8080")
.waitForElementVisible('#app', 5000)
.assert.ok(true)
.end()
}
}
throwing the folowing error:
Error while running .isElementDisplayed() protocol action: TypeError [ERR_UNESCAPED_CHARACTERS]: Error while trying to create HTTP request for "/wd/hub/session/28a21f6ed7009d54e70663e3ed407eb6/element/[object Object]/displayed": Request path contains unescaped cha
racters
at new ClientRequest (_http_client.js:115:13)
at Object.request (http.js:42:10)
at HttpRequest.createHttpRequest (C:\Users\john.doe\Desktop\Développement\App\vue\node_modules\nightwatch\lib\http\request.js:138:55)
at HttpRequest.send (C:\Users\john.doe\Desktop\Développement\App\vue\node_modules\nightwatch\lib\http\request.js:217:29)
at Promise (C:\Users\john.doe\Desktop\Développement\App\vue\node_modules\nightwatch\lib\transport\transport.js:193:15)
at new Promise (<anonymous>)
at Selenium2Protocol.sendProtocolAction (C:\Users\john.doe\Desktop\Développement\App\vue\node_modules\nightwatch\lib\transport\transport.js:191:12)
at Selenium2Protocol.runProtocolAction (C:\Users\john.doe\Desktop\Développement\App\vue\node_modules\nightwatch\lib\transport\jsonwire.js:61:17)
at Object.isElementDisplayed (C:\Users\john.doe\Desktop\Développement\App\vue\node_modules\nightwatch\lib\transport\actions.js:54:10)
at Selenium2Protocol.executeProtocolAction (C:\Users\john.doe\Desktop\Développement\App\vue\node_modules\nightwatch\lib\transport\transport.js:239:48)
I get this error when I provide a valid selector. I tried with a non existing selector and, in this case, I get a simple ... expected "visible" but got: "not found".
Here is my Nightwatch configuration file:
module.exports = {
"src_folders": ["tests/e2e/specs"],
"output_folder": "tests/e2e/reports",
"page_objects_path": "tests/e2e/page-objects",
"custom_assertions_path": "tests/e2e/custom-assertions",
"custom_commands_path": "tests/e2e/custom-commands",
"test_workers": {
"enabled": true,
"workers": "auto"
},
"selenium" : {
"start_process" : true,
"server_path" : "./node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.141.59.jar",
"log_path" : "tests/e2e/logs",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./node_modules/chromedriver/lib/chromedriver/chromedriver.exe"
}
},
"test_settings" : {
"default" : {
"launch_url": 'https://www.google.com',
"selenium_port": 4444,
"selenium_host": "localhost",
"silent": true,
"screenshots": {
"enabled": true,
"path": ""
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions": {
"w3c": false
}
},
"webdriver": {
"use_legacy_jsonwire": false
}
},
"firefox": {
"desiredCapabilities": {
"browserName": "firefox",
"alwaysMatch": {
"acceptInsecureCerts": true,
"moz:firefoxOptions": {
"args": []
}
}
}
}
}
};
Any ideas of what could produce this error?
Let me know if I should provide other files from the node_modules folder for instance.
Following the link of Estus Flask solved my problem:
Simply add this lines in the default configuration
"chromeOptions": {
"w3c": false
}

Error importing heatmap.js & heamap-leaflet.ja with RequireJS

I have this require-config file:
(there are more packages in the config ....)
require.config({
baseUrl: '/static',
waitSeconds: 10,
packages: [
{
name: 'leaflet',
location: './bower_components/leaflet-dist',
main: 'leaflet'
},
{
name: 'heatmap',
location: './bower_components/heatmap.js-amd/src',
main: 'heatmap'
},
{
name: 'heatmapleaflet',
location: './bower_components/heatmap.js-amd/src',
main: 'heatmap-leaflet'
}
]
});
When I try to use heatmap or heatmap-leaflet, requireJS can't find the packages and show them as undefined.
require(['leaflet','heatmap','heatmapleaflet'],function(leaflet, heatmap, heatmapleaflet)
{
console.log(leaflet); // Works
console.log(heatmap); // undefined
console.log(heatmapleaflet); //undefined
}
I tried different approaches and there is no result.
What is wrong?

Categories