Build error with Keystone v5 – #keystonejs/app-next with Heroku CLI - heroku

I'm having issues trying to upload a website using this Keystone v5 + Next.js and everything runs well at dev and even builds locally: Styled-components + Styled-system, SSR and .babelrc (for styled-components config), also next.config.js (for jsconfig.json). But at the time that I do this line of code, using Heroku CLI it chash after everything upload
command line
git push heroku develop:master
doing it that way due I'm testing at develop branch from origin repo.
Heroku log
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: YARN_PRODUCTION=true
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 12.12.0
remote: engines.npm (package.json): unspecified (use default)
remote: engines.yarn (package.json): 1.22.4
remote:
remote: Resolving node version 12.12.0...
remote: Downloading and installing node 12.12.0...
remote: Using default npm version: 6.11.3
remote: Resolving yarn version 1.22.4...
remote: Downloading and installing yarn (1.22.4)...
remote: Installed yarn 1.22.4
remote:
remote: -----> Installing dependencies
remote: Installing node modules (yarn.lock)
remote: yarn install v1.22.4
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info fsevents#2.1.3: The platform "linux" is incompatible with this module.
remote: info "fsevents#2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: info fsevents#1.2.13: The platform "linux" is incompatible with this module.
remote: info "fsevents#1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: warning " > graphql-tag#2.10.3" has unmet peer dependency "graphql#^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
remote: warning "#keystonejs/fields > #apollo/react-hooks#3.1.5" has unmet peer dependency "#types/react#^16.8.0".
remote: warning "#keystonejs/fields > slate#0.47.9" has unmet peer dependency "immutable#>=3.8.1 || >4.0.0-rc".
remote: warning "#keystonejs/fields > slate-react#0.22.10" has unmet peer dependency "immutable#>=3.8.1 || >4.0.0-rc".
remote: warning "react-apollo > #apollo/react-common#3.1.4" has unmet peer dependency "#types/react#^16.8.0".
remote: warning "react-apollo > #apollo/react-common#3.1.4" has unmet peer dependency "apollo-utilities#^1.3.2".
remote: warning "react-apollo > #apollo/react-common#3.1.4" has unmet peer dependency "graphql#^14.3.1".
remote: warning " > apollo-cache-inmemory#1.6.6" has unmet peer dependency "graphql#^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
remote: warning " > apollo-client#2.6.10" has unmet peer dependency "graphql#^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
remote: warning "#keystonejs/apollo-helpers > apollo-link#1.2.14" has unmet peer dependency "graphql#^0.11.3 || ^0.12.3 || ^0.13.0 || ^14.0.0 || ^15.0.0".
remote: warning "#keystonejs/adapter-mongoose > #keystonejs/fields-mongoid > #keystonejs/fields > slate-react > react-immutable-proptypes#2.2.0" has unmet peer dependency "immutable#>=3.6.2".
remote: warning "#keystonejs/adapter-mongoose > #keystonejs/fields-mongoid > #keystonejs/fields > slate-react > slate-prop-types#0.5.44" has unmet peer dependency "immutable#>=3.8.1".
remote: warning "#keystonejs/apollo-helpers > apollo-cache#1.3.5" has unmet peer dependency "graphql#^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
remote: warning "#keystonejs/apollo-helpers > apollo-utilities#1.3.4" has unmet peer dependency "graphql#^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
remote: warning "#keystonejs/apollo-helpers > #apollo/react-components#3.1.5" has unmet peer dependency "graphql#^14.3.1".
remote: warning " > #keystonejs/app-graphql#5.1.7" has unmet peer dependency "express#^4.17.1".
remote: warning "#keystonejs/app-graphql > #keystonejs/app-graphql-playground#5.1.3" has unmet peer dependency "express#^4.17.1".
remote: warning " > apollo-link-http#1.5.17" has unmet peer dependency "graphql#^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
remote: warning "#keystonejs/app-graphql > #keystonejs/app-graphql-playground > #apollographql/graphql-playground-react > react-codemirror#1.0.0" has incorrect peer dependency "react#>=15.5 <16".
remote: warning "#keystonejs/app-graphql > #keystonejs/app-graphql-playground > #apollographql/graphql-playground-react > react-codemirror#1.0.0" has incorrect peer dependency "react-dom#>=15.5 <16".
remote: warning " > react-apollo#3.1.5" has unmet peer dependency "#types/react#^16.8.0".
remote: warning " > react-apollo#3.1.5" has unmet peer dependency "graphql#^14.3.1".
remote: warning "react-apollo > #apollo/react-hoc#3.1.5" has unmet peer dependency "#types/react#^16.8.0".
remote: warning "react-apollo > #apollo/react-hoc#3.1.5" has unmet peer dependency "graphql#^14.3.1".
remote: warning " > styled-components#5.1.1" has unmet peer dependency "react-is#>= 16.8.0".
remote: [4/4] Building fresh packages...
remote: Done in 92.86s.
remote:
remote: -----> Build
remote: Running build (yarn)
remote: yarn run v1.22.4
remote: $ cross-env NODE_ENV=production keystone build
remote: - Initialising Keystone CLI
remote: ℹ Command: keystone build
remote: -
remote: ✔ Validated project entry file ./index.js
remote: - Initialising Keystone instance
remote: ✔ Initialised Keystone instance
remote: - Exporting Keystone build to ./dist
**remote: warn - You have enabled experimental feature(s).
remote:
remote: warn - Experimental features are not covered by semver, and may cause** unexpected or broken application behavior. Use them at your own risk.
remote: Creating an optimized production build...
remote: Attention: Next.js now collects completely anonymous telemetry regarding usage.
remote: This information is used to shape Next.js' roadmap and prioritize features.
remote: You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
remote: https://nextjs.org/telemetry
remote:
remote: > Using external babel configuration
remote: > Location: "/tmp/build_a5f2f47908fc7f68e09dd51d79d5e3f7/app/.babelrc"
remote:
**remote: Failed to compile.
remote:
remote: ./pages/about-us.js
remote: Module not found: Can't resolve 'components/UI/layout' in '/tmp/build_a5f2f47908fc7f68e09dd51d79d5e3f7/app/pages'
remote:
remote: ✖ Exporting Keystone build to ./dist
remote: Error: > Build failed because of webpack errors
remote: at build (/tmp/build_a5f2f47908fc7f68e09dd51d79d5e3f7/node_modules/next/dist/build/index.js:13:917)**
remote: at async Promise.all (index 2)
remote: at async Object.exec (/tmp/build_a5f2f47908fc7f68e09dd51d79d5e3f7/node_modules/#keystonejs/keystone/bin/commands/build.js:42:7)
remote: error Command failed with exit code 1.
remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to xxxx.
remote:
Yes, I do know that it could be a webpack config error and I don't know what does mean about experimental feature.
keystone.js
const { Keystone } = require('#keystonejs/keystone');
const { PasswordAuthStrategy } = require('#keystonejs/auth-password');
const { GraphQLApp } = require('#keystonejs/app-graphql');
const { AdminUIApp } = require('#keystonejs/app-admin-ui');
const { NextApp } = require('#keystonejs/app-next');
const session = require('express-session');
const MongoStore = require('connect-mongo')(session);
const { UserSchema } = require('./models');
const initialiseData = require('./initial-data');
const { MongooseAdapter: Adapter } = require('#keystonejs/adapter-mongoose');
const PROJECT_NAME = 'Website Name';
const adapterConfig = {
mongoUri: process.env.MONGO_URI,
useNewUrlParser: true,
useFindAndModify: false,
useUnifiedTopology: true,
};
const keystone = new Keystone({
name: PROJECT_NAME,
adapter: new Adapter(adapterConfig),
onConnect: process.env.CREATE_TABLES !== 'true' && initialiseData,
cookieSecret: 'long_secret',
cookie: {
secure: process.env.NODE_ENV === 'production',
maxAge: 1000 * 60 * 60 * 24 * 30,
sameSite: false,
},
secureCookies: false,
sessionStore: new MongoStore({
url: process.env.MONGO_URI,
autoReconnect: true,
secret: 'long_secret',
mongooseConnection: adapterConfig,
autoRemove: 'disabled'
})
});
keystone.createList('User', UserSchema);
const authStrategy = keystone.createAuthStrategy({
type: PasswordAuthStrategy,
list: 'User',
});
module.exports = {
keystone,
apps: [
new GraphQLApp(),
new AdminUIApp({
enableDefaultRoute: false,
authStrategy,
}),
new NextApp({
dir: 'app',
})
],
configureExpress: app => {
app.set('trust proxy', 1);
}
};
I'm not pretty sure what I'm doing wrong, neither witch configuration do I need to do at next.config.js, since the only config that I have is this:
module.exports = {
experimental: {
jsconfigPaths: true,
}
}
with or without it, it gives me the same error, just the route changes and this error only occurs on pages folder
Folder Structure
./app
|– api/
|– apifile.js
|
|– components/
|– ...componentsfiles.js
|
|– hooks/
|– ...hooksfiles.js
|
|– pages/
|– ...pagesfiles.js
|
|– public/
|– assets/
|
|– utils
|– style
|_
|– ...styles.js
|– ...otherutils.js
|
|– .babelrc
|
|– jsconfig.json
|
|– next.config.js
./models/
./index.js (keystone.js)
./initial-data.js
./package.json
and this is my package.json file
{
"name": "xxxx-xxxx",
"description": "xxxx xxxx",
"private": true,
"version": "5.0.7",
"author": "Andler Develops",
"repository": "https://github.com/keystonejs/keystone/tree/master/packages/create-keystone-app/example-projects/starter",
"homepage": "https://github.com/keystonejs/keystone",
"license": "MIT",
"engines": {
"node": "12.12.0",
"yarn": "1.22.4"
},
"scripts": {
"dev": "cross-env NODE_ENV=development DISABLE_LOGGING=true keystone dev",
"build": "cross-env NODE_ENV=production keystone build",
"start": "cross-env NODE_ENV=production keystone start",
"create-tables": "cross-env CREATE_TABLES=true keystone create-tables"
},
"dependencies": {
"#keystonejs/adapter-mongoose": "^8.1.0",
"#keystonejs/apollo-helpers": "^5.1.4",
"#keystonejs/app-admin-ui": "^6.0.0",
"#keystonejs/app-graphql": "^5.1.7",
"#keystonejs/app-next": "^5.1.2",
"#keystonejs/auth-password": "^5.1.7",
"#keystonejs/field-content": "^6.0.1",
"#keystonejs/fields": "^10.0.0",
"#keystonejs/file-adapters": "^6.0.2",
"#keystonejs/keystone": "^9.0.0",
"#material-ui/core": "^4.10.0",
"#material-ui/lab": "^4.0.0-alpha.54",
"#styled-system/theme-get": "^5.1.2",
"aos": "^2.3.4",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link-http": "^1.5.17",
"connect-mongo": "^3.2.0",
"cross-env": "^7.0.2",
"dotenv": "^8.2.0",
"envy": "^2.0.0",
"express-session": "^1.17.1",
"framer-motion": "^1.11.0",
"graphql-tag": "^2.10.3",
"next": "^9.4.4",
"react": "^16.13.1",
"react-apollo": "^3.1.5",
"react-dom": "^16.13.1",
"react-helmet": "^6.0.0",
"react-icons": "^3.10.0",
"react-lazy-load-image-component": "^1.5.0-beta.0",
"rebass": "^4.0.7",
"slugify": "^1.4.0",
"styled-components": "^5.1.1",
"styled-system": "^5.1.5"
},
"devDependencies": {
"babel-plugin-styled-components": "^1.10.7",
"prettier": "2.0.5"
}
}

I ran into this yesterday, it works locally, but when I deploy it does not and I get the error you're getting. I fixed it by moving my dependencies from my nextjs package.json, to the keystone package.json in the root of my project. I completely deleted my node_modules in the nextjs folder as I guess it just doesn't look at it.

I also didn't have problems on my local machine, but when built in a docker container received the error. I changed versions of the core packages to the ones in the beginner's guide:
"next": "9.3.5",
"react": "16.13.1",
"react-dom": "16.13.1",
I don't know why, but it helped. I lost more than 4 hours debugging this sh**...

Related

Unknown word error building a Chrome Extension using Laravel-mix with vue3

I'm in the process of building a chrome-extension manifest Version3 in vue.js 3 using laravel-mix. In order to prevent styles leaking between the extension code and the current browser tab, I've loaded the content-scripts code into a shadow-dom element. This is working however as the default compiling process from laravel-mix is to add the styles in a style tag in the head of the document, currently the css styling is being prevented from reaching the very place it should be isolated to. I've tried following the laravel-mix documentation that suggests using a function that lazy loads the style tag within the shadow dom element however I am getting this error and cannot work out what is wrong - guessing there is missing configs. Thanks in advance for any help.
Error Details
ERROR in ./src/assets/css/content_shinego.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/laravel-mix/node_modules/postcss-loader/dist/cjs.js):
SyntaxError
(4:7) C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\src\assets\css\content_shinego.css Unknown word
2 | var exported = {};
3 |
4 | import API from "!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js";
| ^
5 | import domAPI from "!../../../node_modules/style-loader/dist/runtime/styleDomAPI.js";
6 |
at processResult (C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\webpack\lib\NormalModule.js:758:19)
at C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\webpack\lib\NormalModule.js:860:5
at C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\loader-runner\lib\LoaderRunner.js:400:11
at C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\loader-runner\lib\LoaderRunner.js:252:18
at context.callback (C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\loader-runner\lib\LoaderRunner.js:124:13)
at Object.loader (C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\laravel-mix\node_modules\postcss-loader\dist\index.js:140:7)
ERROR in ./src/assets/css/popup_shinego.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/laravel-mix/node_modules/postcss-loader/dist/cjs.js):
SyntaxError
(4:7) C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\src\assets\css\popup_shinego.css Unknown word
2 | var exported = {};
3 |
4 | import API from "!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js";
| ^
5 | import domAPI from "!../../../node_modules/style-loader/dist/runtime/styleDomAPI.js";
6 |
at processResult (C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\webpack\lib\NormalModule.js:758:19)
Capture\draft\node_modules\loader-runner\lib\LoaderRunner.js:400:11 at C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\loader-runner\lib\LoaderRunner.js:252:18 at context.callback (C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\loader-runner\lib\LoaderRunner.js:124:13) at Object.loader (C:\Users\ollie\Documents\Shine\ChromeExtensionScreenCapture\draft\node_modules\laravel-mix\node_modules\postcss-loader\dist\index.js:140:7)
2 ERRORS in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack compiled with 4 errors
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! yobi-chrome#0.1.0 local: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --env=local --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the yobi-chrome#0.1.0 local script.
npm ERR! C:\Users\ollie\AppData\Roaming\npm-cache_logs\2022-08-30T10_09_41_700Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! yobi-chrome#0.1.0 dev: npm run local
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the yobi-chrome#0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ollie\AppData\Roaming\npm-cache_logs\2022-08-30T10_09_41_718Z-debug.log
webpack.mix.js file
let mix = require('laravel-mix')
let path = require('path')
mix.setPublicPath('./')
mix.alias({
'#': path.join(__dirname, 'src')
});
mix.css('src/assets/css/content_shinego.css', 'dist/assets/css')
.css('src/assets/css/popup_shinego.css', 'dist/assets/css')
.css('src/assets/css/font-awesome.min.css', 'dist/assets/css')
.css('src/assets/css/mdbvue.css', 'dist/assets/css')
mix.js('src/popup/popup.js', 'dist/popup')
.js('src/content_scripts/content.js', 'dist/content_scripts')
.vue();
mix.copy('src/manifest.json', 'dist/')
.copy('src/background.js', 'dist/')
.copy('./css-loader-shim.js', 'dist/')
.copy('src/popup/popup.html', 'dist/popup')
.copy('src/assets/img/', 'dist/assets/img')
.copy('src/assets/icons/', 'dist/assets/icons')
.options({
processCssUrls: false
})
mix.webpackConfig({
module: {
rules: [
{
test: /\_shinego.css$/,
include: path.resolve(__dirname, 'src/assets/css'),
use: [
{
loader: "style-loader",
options: {
injectType: "lazyStyleTag",
insert: function insertIntoTarget(element, options) {
var parent = options.target || document.head;
parent.appendChild(element);
}
},
}
],
}
]
}
});
** Relevant package.json **
"dependencies": {
"#fortawesome/vue-fontawesome": "^2.0.8",
"axios": "^0.27.2",
"bootstrap-vue": "^2.22.0",
"fibers": "^5.0.2",
"fontawesome-free": "^1.0.4",
"lodash": "^4.17.21",
"mdb-vue-ui-kit": "^2.0.0",
"mdbvue": "git+https://oauth2:***#git.mdbootstrap.com/mdb/vue/vu-pro.git",
"postcss-loader": "^7.0.1",
"sass": "^1.54.4",
"vue-shadow-dom": "^4.2.0"
},
"devDependencies": {
"#types/chrome": "^0.0.194",
"#types/webpack-env": "^1.18.0",
"#vue/compiler-sfc": "^3.2.37",
"cross-env": "^7.0.3",
"laravel-mix": "^6.0.49",
"style-loader": "^3.3.1",
"types": "^0.1.1",
"vue": "^3.2.37",
"vue-loader": "^16.8.3",
"vue-template-compiler": "^2.7.9",
"webpack": "^5.74.0"
}

Why my package.json file shows react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz" instead of react-native version

Why my package.json file shows
react-native:
"https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz"
instead of a react-native version like
react-native: 0.60.
Because of this I'm getting this error:
Error: react-native is not installed. Please run npm install or
yarn in your project directory. Couldn't start project. Please fix
the errors and restart the project.
Actually I've bought a react-native app from Codecanyon but the developer is not helping me to configure the app. It's been 4 days I'm not able to build the app. It has a php backend that I've uploaded and is working fine, but building app is a nightmare for me. Can anyone help?
Thanks
edit1:
So after removing the node_modules and doing yarn install again the app is giving this error :
fontFamily "AntDesign" is not a system font and has not been loaded through Font.loadAsync.
If you intended to use a system font, make sure you typed the name correctly and that it is supported by your device operating system.
If this is a custom font, be sure to load it with Font.loadAsync.
Here is my package.json file
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#react-native-community/masked-view": "0.1.10",
"expo": "^38.0.0",
"expo-ads-admob": "~8.2.1",
"expo-facebook": "~8.2.1",
"expo-font": "~8.2.1",
"firebase": "7.9.0",
"moment": "^2.27.0",
"native-base": "^2.13.12",
"react": "16.11.0",
"react-dom": "16.11.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
"react-native-carousel": "^0.12.0",
"react-native-device-detection": "^0.2.1",
"react-native-form-validator": "^0.3.2",
"react-native-gesture-handler": "~1.6.0",
"react-native-keyboard-aware-scroll-view": "^0.9.2",
"react-native-map-link": "^2.7.10",
"react-native-maps": "0.27.1",
"react-native-modalbox": "^2.0.0",
"react-native-reanimated": "~1.9.0",
"react-native-render-html": "^4.2.1",
"react-native-root-toast": "^3.2.1",
"react-native-safe-area-context": "~3.0.7",
"react-native-safe-area-view": "^1.1.1",
"react-native-screens": "~2.9.0",
"react-native-star-rating": "^1.1.0",
"react-native-super-grid": "^4.0.2",
"react-native-timeago": "^0.5.0",
"react-native-vector-icons": "^7.0.0",
"react-native-web": "~0.11.7",
"react-native-webview": "^10.3.2",
"react-navigation": "^4.4.0",
"react-navigation-drawer": "^2.5.0",
"react-navigation-stack": "^2.8.2",
"tcomb-form-native": "^0.6.20"
},
"devDependencies": {
"#babel/core": "^7.11.1",
"babel-preset-expo": "^8.2.3"
},
"private": true
}
App.js:
import React from 'react';
import { Asset } from 'expo-asset';
import * as Font from 'expo-font';
import { AppLoading } from 'expo';
import { Root } from "native-base";
import { StatusBar } from "react-native";
import AppPreLoader from "./application/components/AppPreLoader";
import firebaseConfig from './application/utils/Firebase';
import * as firebase from 'firebase';
firebase.initializeApp(firebaseConfig);
import GuestNavigation from './application/navigations/Guest';
import LoggedNavigation from './application/navigations/Logged';
console.disableYellowBox = true;
function cacheImages(images) {
return images.map(image => {
if (typeof image === 'string') {
return Image.prefetch(image);
} else {
return Asset.fromModule(image).downloadAsync();
}
});
}
export default class App extends React.Component {
constructor () {
super();
this.state = {
isLogged: false,
loaded: false,
isReady: false,
}
}
async _loadAssetsAsync() {
const imageAssets = cacheImages([
require('./assets/images/header.jpg'),
require('./assets/images/logo.png'),
require('./assets/images/logo_dark.png'),
require('./assets/images/star.png'),
require('./assets/images/avatar.png'),
require('./assets/images/emptylist.png'),
require('./assets/images/avatar.jpg'),
require('./assets/images/nointernet.png'),
require('./assets/images/contact.png'),
require('./assets/images/address.png'),
require('./assets/images/audience.png'),
require('./assets/images/schedule.png'),
require('./assets/images/phone.png'),
require('./assets/images/website.png'),
require('./assets/images/bookmarked.png'),
require('./assets/images/checked.png'),
]);
await Promise.all([...imageAssets]);
}
async componentDidMount () {
await Expo.Font.loadAsync({
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf")
});
await firebase.auth().onAuthStateChanged((user) => {
if(user !== null) {
this.setState({
isLogged: true,
loaded: true
});
} else {
this.setState({
isLogged: false,
loaded: true
});
}
})
}
render() {
if (!this.state.isReady) {
return (
<AppLoading
startAsync={this._loadAssetsAsync}
onFinish={() => this.setState({ isReady: true })}
onError={console.warn}
/>
);
}
const {isLogged, loaded, isReady} = this.state;
if ( ! loaded) {
return (
<AppPreLoader/>
);
}
if(isLogged && isReady) {
return (
<Root>
<StatusBar barStyle="light-content" translucent={true} backgroundColor={'transparent'} />
<LoggedNavigation />
</Root>
);
} else {
return (
<Root>
<StatusBar barStyle="dark-content" translucent={true} backgroundColor={'transparent'} />
<GuestNavigation />
</Root>
);
}
}
}
edit2:
Also while installing packages I'm getting these warnings:
warning expo > expo-constants > fbjs > core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3. warning expo > fbemitter > fbjs > core-js#1.2.7: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3. warning react-native > fbjs-scripts > core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3. warning react-native
metro-babel-register > core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3. warning react-native > #react-native-community/cli > #hapi/joi#15.1.1: joi is leaving the #hapi organization and moving back to 'joi' (https://github.com/sideway/joi/issues/2411) warning react-native > #react-native-community/cli > #hapi/joi > #hapi/address#2.1.4: This version has been deprecated and is no longer supported or maintained warning react-native > #react-native-community/cli > #hapi/joi > #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained warning react-native > #react-native-community/cli > #hapi/joi > #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained warning react-native > #react-native-community/cli > #hapi/joi > #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained warning react-native > #react-native-community/cli > #hapi/joi > #hapi/topo > #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained warning react-native > #react-native-community/cli > metro-core > jest-haste-map > fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. warning react-native > #react-native-community/cli > metro-core > jest-haste-map > micromatch
snapdragon > source-map-resolve > resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated warning react-native
#react-native-community/cli > metro-core > jest-haste-map > micromatch > snapdragon > source-map-resolve > urix#0.1.0: Please see https://github.com/lydell/urix#deprecated warning react-native-web > deep-assign#3.0.0: Check out lodash.merge or merge-options instead. [2/4] Fetching packages... info fsevents#1.2.13: The platform "win32" is incompatible with this module. info "fsevents#1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... warning "native-base > eslint-config-prettier#6.11.0" has unmet peer dependency "eslint#>=3.14.1". warning "native-base > #codler/react-native-keyboard-aware-scroll-view#1.0.0" has incorrect peer dependency "react-native#>=0.63.0". warning " > react-native-carousel#0.12.0" has unmet peer dependency "create-react-class#>=15.6.2". warning " > react-native-maps#0.27.1" has unmet peer dependency "prop-types#^15.0 || ^16.0". warning " > react-native-render-html#4.2.2" has unmet peer dependency "prop-types#>=15.5.10".
Why you are seeing a GitHub URL instead of react-native version.
Because you are using expo and expo is a library based on react-native you are not using react-native-cli
https://docs.expo.io/
Unable to start the project
Follow these steps to start the peoject.
Remove node_modules folder.
run "yarn install".
run "expo start".
For the font loading have a look at this.
https://docs.expo.io/versions/latest/sdk/font/

jhipster Project won't build for prod profile : gradlew -Pprod bootWar fails on taks webpack

ISSUE SOLVED see below for infos
after searching for a solutions for 2 days now i give up. I coudn't find a similar issue on the web and i don't know what to do.
Hope somebody can help there...
Issue
The application is building and running fine with gradlew -Pdev bootWar jibDockerBuild
However, the build won't work when selecting the prod profile:
gradlew -Pprod bootWar jibDockerBuild
Reference Exception
ERROR in Illegal State: referring to a type without a variable
{"filePath":"D:/dev/myApp/node_modules/#angular/forms/forms.d.ts",
"name":"FormGroupDirective","members":[]}
FULL EXCEPTION
The following is printed on execution:
D:\dev\myApp>gradlew -Pprod bootWar jibDockerBuild
> Task :yarn_install
yarn install v1.9.4
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents#1.2.4: The platform "win32" is incompatible with this module.
info "fsevents#1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > bootstrap#4.1.3" has unmet peer dependency "jquery#1.9.1 - 3".
warning " > bootstrap#4.1.3" has unmet peer dependency "popper.js#^1.14.3".
warning " > ngx-webstorage#2.0.1" has incorrect peer dependency "#angular/core#^5.0.0".
[5/5] Building fresh packages...
Done in 97.47s.
> Task :webpack
yarn run v1.9.4
$ yarn run cleanup && yarn run webpack:prod:main && yarn run clean-www
$ rimraf build/{aot,www}
$ yarn run webpack --config webpack/webpack.prod.js --profile
$ node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config webpack/webpack.prod.js --profile
(node:28256) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
Hash: 6aab3d14e434ee333c51
Version: webpack 4.8.0
Time: 8812ms
Built at: 2018-10-07 18:52:03
6 assets
Entrypoint polyfills = app/polyfills.6aab3d14e434ee333c51.bundle.js
Entrypoint global = global.1e92ecdbfdaf2bb32590.css app/global.6aab3d14e434ee333c51.bundle.js
Entrypoint main = app/main.6aab3d14e434ee333c51.bundle.js
[0] ./src/main/webapp/app/app.main.ts 0 bytes {0} [built]
factory:4638ms building:3545ms = 8183ms
[2] ./src/main/webapp/content/css/global.css 39 bytes {1} [built]
factory:4639ms building:2778ms = 7417ms
[3] ./src/main/webapp/app/polyfills.ts 0 bytes {2} [built]
factory:4638ms building:3540ms = 8178ms
+ 1 hidden module
ERROR in Illegal State: referring to a type without a variable {"filePath":"D:/dev/myApp/node_modules/#angular/forms/forms.d.ts","name":"FormGroupDirective","members":[]}
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
> Task :webpack FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':webpack'.
> Process 'command 'yarn.cmd'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1m 58s
5 actionable tasks: 3 executed, 2 up-to-date
ENVIRONMENT
Windows 10
Using JHipster version installed locally in current project's node_modules
Executing jhipster:info
Options: from-cli: true
Welcome to the JHipster Information Sub-Generator
JHipster Version(s)
myApp#0.0.0 D:\dev\myApp
`-- generator-jhipster#5.4.1
JHipster configuration, a .yo-rc.json file generated in the root folder
<details>
<summary>.yo-rc.json file</summary>
<pre>
{
"generator-jhipster": {
"promptValues": {
"packageName": "de.myApp.myApp",
"nativeLanguage": "de"
},
"jhipsterVersion": "5.4.1",
"applicationType": "monolith",
"baseName": "myApp",
"packageName": "de.myApp.myApp",
"packageFolder": "de/myApp/myApp",
"serverPort": "8080",
"authenticationType": "session",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "gradle",
"enableSwaggerCodegen": false,
"rememberMeKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
"clientFramework": "angularX",
"useSass": false,
"clientPackageManager": "yarn",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "de",
"languages": [
"de",
"en",
"fr"
],
"appsFolders": [
"myApp"
],
"directoryPath": "../",
"monitoring": "elk",
"consoleOptions": [
"curator"
],
"jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons"
}
}
</pre>
</details>
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
SKIPPED
Environment and Tools
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
git version 1.8.4.msysgit.0
node: v8.11.3
npm: 5.6.0
yarn: 1.9.4
Docker version 18.06.1-ce, build e68fc7a
docker-compose version 1.22.0, build f46880fe
I found the cause of the issue:
I obviously placed the ReactiveFormModul imports at the wrong place. I had it in a module "upwards", but actually, I had to place it into the module where I actually have the components defining the form. To be honest ... I don't understand exactly why this is an issue, maybe someone can clarify.
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '#angular/core';
import { RouterModule } from '#angular/router';
import { ReactiveFormsModule } from '#angular/forms';
*** other imports
#NgModule({
imports: [***, ReactiveFormsModule, *** ROUTER stuff,
declarations: [MyReactiveFormComponent],
schemas: [***]
})
export class MyReactiveFormModule {}
After this, I found also other issues that was working fine in the dev-build (again ... don't understand the reason. I guess that has to do with a stricter "compile" configuration):
The variable referencing the formGroup was declared "private". Therefore I got a compile Error on the prod profile. I had to change it so that it can be accessed by the html template.
Variables accessed in html must be public (or accessible by means of a getter method)
Accessing Form Controls in subsequent html elements must be "public"
Code-Example:
MyReactiveComponent.ts:
this.myForm = this.fb.group({
id: [this.myObject.id],
date: [this.myObject.date, Validators.required],
number: [this.myObject.number, [Validators.required, Validators.min(2), Validators.max(100)]],
dynamicOptions: this.fb.array([]),
prefilledOptions: [this.prefilledOptions, Validators.required]
});
MyReactiveComponent.html:
<div class="row justify-content-center">
<div class="col-8">
<form [formGroup]="myForm" id="myFormId" novalidate (ngSubmit)="save()" #editForm="ngForm">
<h2>Create or edit a Play</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group">
<input type="number" class="form-control" formControlName="number" (blur)="updateNumber()" id="field_number" required min="2" jhiMin="2" max="100" jhiMax="100"/>
<div [hidden]="!(number?.dirty && number?.invalid)">
<small class="form-text text-danger"
[hidden]="!number?.errors?.required">
This field is required.
</small>
...
Accessing number in "number?.dirty" for example requires to have a getter-method to be able to access it:
get number() {
return this.myForm.get('number') as FormControl;
}
Hope that helps other when struggling...

Unable to deploy go app with Godeps dependencies on Heroku

I have the following error when i'm trying to push my project on heroku
git push heroku master
Counting objects: 88, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (86/86), done.
Writing objects: 100% (88/88), 18.85 MiB | 686.00 KiB/s, done.
Total 88 (delta 13), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Checking Godeps/Godeps.json file.
remote: -----> Using go1.7.3
remote: -----> Running: go install -v -tags heroku ./...
remote: main.go:8:2: cannot find package "github.com/Sirupsen/logrus" in any of:
remote: /app/tmp/cache/go1.7.3/go/src/github.com/Sirupsen/logrus (from $GOROOT)
remote: /tmp/tmp.Ffkjp5c5US/.go/src/github.com/Sirupsen/logrus (from $GOPATH)
remote: main.go:6:2: cannot find package "github.com/gin-gonic/gin" in any of:
remote: /app/tmp/cache/go1.7.3/go/src/github.com/gin-gonic/gin (from $GOROOT)
remote: /tmp/tmp.Ffkjp5c5US/.go/src/github.com/gin-gonic/gin (from $GOPATH)
remote: ! Push rejected, failed to compile Go app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to eerie-wizard-18479.
remote:
To https://git.heroku.com/eerie-wizard-18479.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/eerie-wizard-18479.git'
I carefully made a godep save ./... before commiting and pushing on heroku, this is my Godeps.json file: (logrus and gin are present in this file)
{
"ImportPath": "github.com/sbouaked/neo-fundations",
"GoVersion": "go1.7",
"GodepVersion": "v74",
"Packages": [
"./..."
],
"Deps": [
{
"ImportPath": "github.com/Sirupsen/logrus",
"Comment": "v0.10.0-38-g3ec0642",
"Rev": "3ec0642a7fb6488f65b06f9040adc67e3990296a"
},
{
"ImportPath": "github.com/gin-gonic/gin",
"Comment": "v1.0-2-g3900df0",
"Rev": "3900df04d2a88e22beaf6a2970c63648b9e1b0e1"
},
{
"ImportPath": "github.com/gin-gonic/gin/binding",
"Comment": "v1.0-2-g3900df0",
"Rev": "3900df04d2a88e22beaf6a2970c63648b9e1b0e1"
},
{
"ImportPath": "github.com/gin-gonic/gin/render",
"Comment": "v1.0-2-g3900df0",
"Rev": "3900df04d2a88e22beaf6a2970c63648b9e1b0e1"
},
{
"ImportPath": "github.com/golang/protobuf/proto",
"Rev": "98fa357170587e470c5f27d3c3ea0947b71eb455"
},
{
"ImportPath": "github.com/manucorporat/sse",
"Rev": "ee05b128a739a0fb76c7ebd3ae4810c1de808d6d"
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "4bb47a1098b37d69980d96237e2ae4ff56bb5a95"
},
{
"ImportPath": "golang.org/x/sys/unix",
"Rev": "c200b10b5d5e122be351b67af224adc6128af5bf"
},
{
"ImportPath": "gopkg.in/go-playground/validator.v8",
"Comment": "v8.18.1",
"Rev": "5f57d2222ad794d0dffb07e664ea05e2ee07d60c"
},
{
"ImportPath": "gopkg.in/yaml.v2",
"Rev": "a5b47d31c556af34a302ce5d659e6fea44d90de0"
}
]
}
I saw on this post that I have to commit vendor/, but I didn't want to. There is really any solutions for this now ?
If you look at the heroku buildpack for Go (https://github.com/heroku/heroku-buildpack-go/blob/master/bin/compile), it does not currently support GoDeps, as traditional GoDeps style dependency management has been deprecated as Go v1.6. You can convert your GoDeps dependencies to a vendored dependency and that should fix that.
I personally recommend using glide: https://github.com/Masterminds/glide
But you can also use:
https://github.com/kardianos/govendor
or
https://github.com/constabulary/gb
As those are supported in the compile script for the buildpack.
Each of those support an automated conversion of GoDeps to their formats.
If you have ./vendor/vendor.json Heroku will automatically use govendor, unless you configure Heroku to use something otherwise.
This page may help as well https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-go
It does support Godep, technically, but it would seem you have to either use an older version of Go or move GoDeps to vendor.

Dev dependencies needed for Heroku webpack build

I was under the impression that I wouldn't need the devDependencies to be included when I deploy to Heroku a react based app, using Webpack. For example, here's my package.
"scripts": {
"test": "",
"start": "./node_modules/.bin/babel-node server",
"build": "rimraf dist && export NODE_ENV=production && webpack --config ./webpack.production.config.js --progress --profile --colors",
"postinstall": "node deploy",
"eslint": "eslint .",
"jscs": "jscs ."
},
and deploy.js:
if (process.env.NODE_ENV === 'production') {
var child_process = require('child_process');
child_process.exec("webpack -p --config webpack.production.config.js", function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
}
and the Procfile
web ./node_modules/.bin/babel-node server.js
However, when I push to Heroku, I'm constantly getting a webpack command not recognized, so I included all of the devDependencies as normal dependencies to have it working. Am I missing something here?
Heroku set NPM_CONFIG_PRODUCTION to true by default to install dependencies only. If you would like to install devDependencies, you can disable production mode:
$ heroku config:set NPM_CONFIG_PRODUCTION=false
However, since you usually don’t want all devDependencies in your production builds, it’s preferable to move only the dependencies you actually need for production builds into dependencies (bower, grunt, gulp, etc).

Resources