node ace configure is not a registered command in Adonisjs - internationalization

I've been given an adonisjs project that has the following package.json:
{
"name": "adonis-api-app",
"version": "4.1.0",
"adonis-version": "4.1.0",
"description": "Adonisjs boilerplate for API server with pre-configured JWT",
"main": "index.js",
"scripts": {
"start": "node server.js",
"test": "node ace test"
},
"keywords": [
"adonisjs",
"adonis-app"
],
"author": "",
"license": "UNLICENSED",
"private": true,
"dependencies": {
"#adonisjs/ace": "^5.0.8",
"#adonisjs/auth": "^3.0.7",
"#adonisjs/bodyparser": "^2.0.5",
"#adonisjs/cors": "^1.0.7",
"#adonisjs/fold": "^4.0.9",
"#adonisjs/framework": "^5.0.9",
"#adonisjs/ignitor": "^2.0.8",
"#adonisjs/lucid": "^6.1.3",
"#adonisjs/mail": "^3.0.10",
"#adonisjs/validator": "^5.0.6",
"adonis-scheduler": "^3.0.2",
"buffer": "^6.0.3",
"dayjs": "^1.10.4",
"exceljs": "^4.2.1",
"json2csv": "^5.0.6",
"lodash": "^4.17.21",
"mysql": "^2.18.1",
"mysql2": "^2.2.5",
"nuxt-video-player": "^1.0.17"
},
"autoload": {
"App": "./app"
}
I've been asked to make the platform multilingual. So I went to this website for instructions on how to implement i18n: https://docs.adonisjs.com/guides/i18n
As per the instructions, I installed with these commands:
npm i #adonisjs/i18n
node ace configure #adonisjs/i18n
error: `configure` is not a registered command
How come my node ace configure doesn't work? How do I correct the problem?
UPDATE
I think this means my adonisjs framework is from the year 2018. And the earliest version of the i18n module is from 2021. Which i18n module would be compatible with my version of the adonisjs framework?

Related

Module parse failed: Unexpected token in a react with redux toolkit node module

I'm trying to work out how to create a react + redux node module for my react + redux toolkit sites. I've got multiple sites with common components and I'd like to share them using a module.
I have managed to create, publish (using npm publish), and install my node module on to my site, but whenever I try and run with it installed I get the below error for any component I make in the module.
This is the package.json on my node module. I've made sure that any dependencies match the version I use on my sites.
`
{
"name": "cpl-react-test",
"version": "3.0.4",
"peerDependencies": {
"#reduxjs/toolkit": "^1.8.5",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.1.1",
"#testing-library/user-event": "^13.5.0",
"#types/jest": "27.4.1",
"#types/node": "16.11.27",
"#types/react": "18.0.6",
"#types/react-dom": "18.0.2",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-redux": "8.0.2",
"react-scripts": "5.0.1",
"typescript": "^4.6.3",
"web-vitals": "^3.0.1"
},
"devDependencies": {
"#reduxjs/toolkit": "^1.8.5",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.1.1",
"#testing-library/user-event": "^13.5.0",
"#types/jest": "27.4.1",
"#types/node": "16.11.27",
"#types/react": "18.0.6",
"#types/react-dom": "18.0.2",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-redux": "8.0.2",
"react-scripts": "5.0.1",
"typescript": "^4.6.3",
"web-vitals": "^3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), using the [Redux](https://redux.js.org/) and [Redux Toolkit](https://redux-toolkit.js.org/) TS template.",
"main": "index.tsx",
"author": "",
"license": "ISC"
}
`
I have researched this a bit, but I'm struggling to find the solution, I think because I don't really understand the problem, or whether I'm going about this the right way at all. Any insight on what I should be looking for or doing would be greatly appreciated.

Webpack not found when deploying using heroku

I'm trying to deploy an app on heroku, but I'm getting an error when it tried to build the app with the webpack command. I have tried a number of fixes but can't seem to get it to work. I tried running the webpack.js file from node_modules like this node node_modules/webpack/bin/webpack.js but that didn't work either. Any ideas would be greatly appreciated! Here is my package.json file:
{
"name": "waste-not-client",
"version": "1.0.0",
"description": "",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "concurrently npm:watch:*",
"build": "webpack --mode production",
"watch:compile": "webpack --mode development --watch",
"watch:serve": "nodemon server/server.js",
"heroku-postbuild": "npm install && npm run build && node server/server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Blue-ocean-HR/blueocean-client.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/Blue-ocean-HR/blueocean-client/issues"
},
"homepage": "/",
"dependencies": {
"#auth0/auth0-react": "^1.12.0",
"axios": "^1.1.3",
"compression": "^1.7.4",
"concurrently": "^7.6.0",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"framer-motion": "^7.6.7",
"nodemon": "^2.0.20",
"path": "^0.12.7",
"react": "^18.2.0",
"react-autocomplete-input": "^1.0.19",
"react-dom": "^18.2.0",
"react-router-dom": "^6.4.3",
"webpack-bundle-analyzer": "^4.7.0"
},
"devDependencies": {
"#babel/core": "^7.12.3",
"#babel/plugin-syntax-jsx": "^7.18.6",
"#babel/preset-env": "^7.12.1",
"#babel/preset-react": "^7.12.5",
"autoprefixer": "^10.4.13",
"babel-jest": "^29.1.2",
"babel-loader": "^8.2.1",
"compression-webpack-plugin": "^10.0.0",
"css-loader": "^6.7.1",
"dotenv-webpack": "^8.0.1",
"postcss": "^8.4.19",
"postcss-loader": "^7.0.1",
"postcss-preset-env": "^7.8.3",
"style-loader": "^3.3.1",
"tailwindcss": "^3.2.4",
"webpack": "^5.75.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1"
},
"engines": {
"node": "v16.16.0"
}
}
The error when I try to deploy on heroku:
sh: 1: webpack: not found
Your start script looks like it's designed for development work with live reloading. That's not what you want on Heroku.
You could rewrite your package.json scripts, but the easiest solution is probably to add a Procfile that Heroku will use in preference to your start script, e.g.
web: node server/server.js
You'll also want to remove your heroku-postbuild script entirely. It just repeats two things that Heroku does automatically (installing dependencies and running your build), and it also includes the runtime command that we now have in our Procfile.

VS 2022 w/Resharper not recognizing syntax in React Scripts

I'm installing some demo React JS applications. Some of them don't show syntax errors while others do. Am I missing a package in my solution? Or is there a setting in my VS Project that needs set/changed?
Here's a screenshot. The project's package.json is below. The code builds and runs fine with the exception of deprecation warnings, etc. (not important at this point).
{
"name": "conversations-demo-sdk-update",
"version": "1.2.0",
"private": true,
"proxy": "http://localhost:3001",
"dependencies": {
"#twilio/conversations": "1.2.0",
"antd": "^3.26.20",
"dotenv": "^10.0.0",
"ngrok": "^3.4.0",
"node-sass": "^6.0.1",
"prop-types": "^15.7.2",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-dropzone": "^10.2.2",
"react-router-dom": "^4.3.1",
"react-scripts": "4.0.1",
"request-promise": "^4.2.6",
"twilio": "~3.6.6"
},
"devDependencies": {
"concurrently": "^3.6.1",
"react-app-rewired": "^2.2.1"
},
"scripts": {
"start": "concurrently \"react-scripts start\" \"node index.js\"",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"keywords": [],
"description": ""
}
The problem ended up being JSX code in JS files. The fix is to enable Resharper's option to allow JSX in JS files.
Solution found here

Electron-Forge SQLite3 database not accessible on MacOS Darwin build after unzipping

I'm having some issues with a CRUD desktop application I developed with the help of a freelancer. It's an electron-forge build that works seamlessly on Windows 10, and works on MacOS initially when accessing the out folder, the strange thing happens when:
I use npm run publish to zip the Mac/Darwin instance
I manually package.zip the results of npm run make
When I do this, and unzip the file to run, the SQLite integration fails completely. The app appears to be working upon start, but no changes can be made to the DB objects, nor can new objects be made.
The freelancer who put together the DB integration said he was not able to solve this issue, but it's impossible to put apps in marketplaces without zipping the application for delivery. I can post code if necessary, I just don't even know what aspect of the code would be relevant, and feel like there has to be something I can install/put in my package.json that might solve this, but I'm just not sure.
Here is my package.json file in case that is helpful:
{
"name": "C",
"productName": "C",
"version": "1.0.2",
"description": "My Electron application description",
"main": "src/index.js",
"scripts": {
"start": "cross-env NODE_ENV=development electron-forge start",
"package": "electron-forge package",
"make": "cross-env NODE_ENV=production electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "A",
"email": "xxx#gmail.com"
},
"license": "NA",
"config": {
"forge": {
"packagerConfig": {
"icon": "src/images/n.ico"
},
"makers": [
{
"name": "#electron-forge/maker-squirrel",
"config": {
"name": "C"
}
},
{
"name": "#electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "#electron-forge/maker-deb",
"config": {}
},
{
"name": "#electron-forge/maker-rpm",
"config": {}
}
]
}
},
"dependencies": {
"axios": "^0.21.1",
"bootstrap": "^4.6.0",
"cross-env": "^7.0.3",
"ebay-oauth-nodejs-client": "^1.2.1",
"electron-better-ipc": "^1.1.1",
"electron-squirrel-startup": "^1.0.0",
"electron-store": "^7.0.2",
"jquery": "^3.6.0",
"json-csv": "^3.0.6",
"sequelize": "^6.5.0",
"sqlite3": "^5.0.0"
},
"devDependencies": {
"#electron-forge/cli": "^6.0.0-beta.54",
"#electron-forge/maker-deb": "^6.0.0-beta.54",
"#electron-forge/maker-rpm": "^6.0.0-beta.54",
"#electron-forge/maker-squirrel": "^6.0.0-beta.54",
"#electron-forge/maker-zip": "^6.0.0-beta.54",
"electron": "10.1.5"
}
}
I found that by simply creating a DMG target (see https://www.electronforge.io/config/makers/dmg) that I did not need to worry about unzipping process. I believe DMG is the ideal approach for packaging Mac OS apps that have something like a SQLite database integration within.

React Native OSX CRNA Compilation of µWebSockets has failed C++11 compiler

Got this issue after ejecting from Expo (with ExpoKit). Had a working environment before ejecting. npm run ios will run with this issue repeating over and over:
Origin: Worker (PID 6336) 12:18:06: [Error] Error: getaddrinfo
ENOTFOUND lcalhost 12:18:06: at errnoException (dns.js:28:10)
12:18:06: at GetAddrInfoReqWrap.onlookup [as oncomplete]
(dns.js:76:26)
Expo XDE will not run at all and repeats this message. XCode includes C++11 compiler.
Error: Compilation of µWebSockets has failed and there is no
pre-compiled binary available for your system. Please install a
supported C++11 compiler and reinstall the module 'uws'.
package.json
{
"name": "OurApp",
"version": "0.0.1",
"private": true,
"devDependencies": {
"babel-eslint": "^8.0.3",
"eslint": "^4.13.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.5.1",
"jest-expo": "^23.0.0",
"react-native-scripts": "1.8.1",
"react-test-renderer": "16.0.0",
"remotedev-rn-debugger": "^0.8.3"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch",
"postinstall": "remotedev-debugger --hostname lcalhost --port 5678 --injectserver",
"eslint": "./node_modules/.bin/eslint"
},
"remotedev": {
"hostname": "localhost",
"port": 5678
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/vector-icons": "^6.2.1",
"axios": "^0.17.1",
"expo": "^23.0.0",
"lodash": "^4.17.4",
"prop-types": "^15.6.0",
"react": "16.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-23.0.0.tar.gz",
"react-native-elements": "^0.18.5",
"react-native-maps": "^0.19.0",
"react-navigation": "^1.0.0-beta.19",
"react-navigation-redux": "^0.1.0",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.2.0",
"remote-redux-devtools": "^0.5.12"
}
}
app.json
{
"expo": {
"isDetached": false,
"privacy": "unlisted",
"sdkVersion": "23.0.0",
"orientation": "portrait",
"primaryColor": "#ffde00",
"name": "OurApp",
"description": "Desc",
"icon": "./resources/icon.png",
"version": "0.0.1",
"slug": "our-app",
"scheme": "ourapp",
"ios": {
"bundleIdentifier": "se.comp.expo",
"config": {
"googleMapsApiKey": "key"
},
"buildNumber": "1.0.0",
"isRemoteJSEnabled": true,
"supportsTablet": false,
"associatedDomains": [
"myDomain.com"
]
},
"android": {
"package": "se.comp.expo",
"versionCode": 1,
"config": {
"googleMaps": {
"apiKey": "key"
}
},
"permissions": [
"CAMERA",
"ACCESS_FINE_LOCATION"
]
},
"notification": {
"icon": "./resources/icon_notify.png",
"color": "#ffde00",
"androidMode": "collapse",
"androidCollapsedTitle": "#{unread_notifications} new"
},
"loading": {
"icon": "./resources/icon.png",
"backgroundColor": "#000000",
"backgroundImage": "./resources/splash.png",
"hideExponentText": true
},
"splash": {
"backgroundColor": "#000000",
"image": "./resources/splash.png",
"resizeMode": "cover"
},
"androidStatusBar": {
"barStyle": "dark-content",
"backgroundColor": "#ffde00"
},
"facebookAppId": "id",
"facebookDisplayName": "OurApp",
"facebookScheme": "fbId",
"androidShowExponentNotificationInShellApp": true
}
}
As #SyedZainAli mentioned this might be caused by environment. A few things to try then is:
Remove node_modules, run npm cache clean and reinstall
Reinstall NodeJS
Create a new app using CRNA and compare
In my case ejecting and using Expo react-native branch (default behavior) causes the issue. Changing back to official react-native npm package resolves the issue. So should be something on Expo's side.
I don't know if this may help you, but it fixed my issue within docker.
In Docker file
//////////////////////////////////////////////////////////////////////////
FROM node:8.9-alpine
RUN apk add --update \
libc6-compat
//////////////////////////////////////////////////////////////////////////
Needed libc6-compact
so try installing libc6-compat.
I had the same issue (below) when I was trying the start an app I got from my team in Expo. And it turned out that uws version in the project was not compatible with the Node version I was using. - node v10.15.0
Switching the node version to be 8.11.4 using nvm - nvm use 8.11.4 solved my issue. (If there is no 8.11.4 version installed use nvm install 8.11.4 instead)
$ expo start
Starting project at /Users/dugong/development/myApp
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
oteDev] Start server...
--------------------------------------------------------------------------------
[Busy] Launching SocketCluster
1555352786943 - Origin: Worker (PID 63541)
[Error] Error: Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system. Please install a supported C++11 compiler and reinstall the module 'uws'.
at native (/Users/dugong/development/myApp/node_modules/socketcluster-server/node_modules/uws/uws.js:38:19)

Resources