create-react-app proxy broken after installing poetry on osx - macos

I'm using create-react-app with a backend application written on Python (using starlette, ariadne and uvicorn) on OSX.
The application was previously running using pipenv. After installing poetry through brew however (brew install poetry), it seems like CRA's proxy stopped working. I suspect this has something to do with homebrew but I have no idea what it is.
Here is my package.json config
{
"name": "chat-ariadne-frontend",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:8000",
"dependencies": {
"#apollo/client": "^3.5.10",
"#testing-library/jest-dom": "^5.16.2",
"#testing-library/react": "^12.1.3",
"#testing-library/user-event": "^13.5.0",
"antd": "^4.18.9",
"graphql": "^16.3.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router": "^6.2.2",
"react-router-dom": "^6.2.2",
"react-scripts": "5.0.0",
"subscriptions-transport-ws": "^0.11.0",
"web-vitals": "^2.1.4"
},
"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"
]
}
}
I'm running the server using poetry run uvicorn app. However, I get the following error in the console:
Proxy error: Could not proxy request /graphql from localhost:3000 to http://localhost:8000.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).
Node version
node -v
v17.6.0
Operating System
OS X Big Sur (version 11.5.2)
Homebrew configuration
HOMEBREW_VERSION: 3.4.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: ea0ddc3297739b7380887d4a7e6b6590c314dca9
Last commit: 2 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 49d411c9fe7e7cd2fba32e76ecbcd5a049556b73
Core tap last commit: 3 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_CORE_GIT_REMOTE: https://github.com/Homebrew/homebrew-core
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.8 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/bin/ruby
CPU: quad-core 64-bit kabylake
Clang: 13.0.0 build 1300
Git: 2.23.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.5.2-x86_64
CLT: 13.2.0.0.1.1638488800
Xcode: N/A

Related

npm showing severity vulnerabilities Laravel in ubuntu 18.04 LTS

running command npm install laravel-mix cross-env --save-dev from web/themes/custom/cp_bootstrap4 directory npm showing severity vulnerabilities Laravel in ubuntu 18.04 LTS
added 744 packages from 474 contributors and audited 745 packages in 90.492s
found 1 moderate severity vulnerability
I have tried commands
1. npm audit fix
2. npm audit fix --force
but 1 severity vulnerabilities not solved.
Output of above command
npm audit security report
Manual Review
Some vulnerabilities require your attention to resolve
Moderate file-type vulnerable to Infinite Loop via malformed MKV file
Package file-type
Patched in >=16.5.4
Dependency of laravel-mix [dev]
Path laravel-mix > imagemin > file-type
my sub-theme package.json
{
"name": "cp_bootstrap4",
"version": "1.0.0",
"description": "[Bootstrap 4](https://www.drupal.org/project/bootstrap4) subtheme.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"cross-env": "^7.0.3",
"laravel-mix": "^6.0.49"
}
}
Please suggest me to resolve this issue!
Try adding to your package.json an override that means it will replace a package in your dependency tree with another version.
The package that has vulnerabilities is file-type, but npm says that you have to update the dependent-package (package>dependent-package>package-with-vulnerabilities), so you will have to update imagemin.
It seems that laravel-mix have not fix this issue, but the solution all ready exist.
Check this URL: https://snyk.io/test/npm/laravel-mix/6.0.20#SNYK-JS-FILETYPE-2958042
Try with this code on your package.json
{
"name": "cp_bootstrap4",
"version": "1.0.0",
"description": "[Bootstrap 4](https://www.drupal.org/project/bootstrap4) subtheme.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"cross-env": "^7.0.3",
"laravel-mix": "^6.0.49"
},
"overrides": {
"laravel-mix": {
"imagemin": "^8.0.1"
}
}
}

Why I'm not able to run npm scripts? [duplicate]

I was running an Electron project, and everything worked just fine. But now when I run any of the scripts in my package.json (including npm start), it just escapes a line and doesn't do anything.
My package.json:
{
"name": "interclip-desktop",
"version": "0.0.7",
"description": "Interclip for desktop",
"repository": "https://github.com/aperta-principium/Interclip-desktop",
"main": "main.js",
"scripts": {
"start": "electron .",
"package-mac": "electron-packager . --overwrite --asar=true --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",
"package-win": "electron-packager . Interclip --overwrite --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Interclip\"",
"package-linux": "electron-packager . Interclip --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds",
"win-install": "node installers/windows/createinstaller.js",
"postinstall": "electron-builder install-app-deps",
"build": "electron-builder --linux",
"release": "electron-builder --linux --publish always"
},
"keywords": [
"Desktop",
"Interclip"
],
"author": "Filip Troníček",
"license": "MIT",
"devDependencies": {
"electron": "^7.1.2",
"electron-builder": "^22.1.0",
"electron-installer-dmg": "^3.0.0",
"electron-packager": "^14.1.1",
"electron-reload": "^1.5.0",
"electron-winstaller": "^4.0.0"
},
"dependencies": {
"axios": "^0.19.0",
"mousetrap": "^1.6.3"
},
"build": {
"appId": "com.aperta-principium.interclip",
"productName": "Interclip",
"mac": {
"category": "public.app-category.utilities"
},
"dmg": {
"icon": false
},
"linux": {
"target": [
"AppImage"
],
"category": "Utility"
}
}
}
I tried updating NPM, didn't work. When I tried in different projects, also doesn't work.
Thanks in advance
npm has a ignore-scripts configuration key. It's expected value is a Boolean and it's set to false by default.
Perhaps it has inadvertently been set to true.
To get/set the ignore-scripts configuration you can utilize the npm-config command:
Check its current setting by running:
npm config get ignore-scripts
If the aforementioned command returns true then reset it to false by running:
npm config set ignore-scripts false
If you are using an integrated terminal (such as the VsCode integrated terminal) try running your npm "run dev' command from your PowerShell (or cmd) terminal. This error arises as a result of your integrated terminal not recognizing your command (especially if you created your app with a git bash terminal).
Try this, and I hope it helps someone cause it always works for me. Cheers!!!

Decoupled Deployment of Web App using Heroku, gh-pages, and MySQL

My team and I created a MERN stack application (M for MySQL) that is planning on hosting our client on gh-pages and our server on heroku. So far we have been unable to deploy because we keep getting errors about our use of the npm package concurrently. Although we can access our heroku url and our gh-pages url, we are unable to connect the two
We have already tried adding a proxy to our package.json within our client folder and have added a .env.development Host name (heroku url)
Root Directory
- client
- package.json
- package-lock.json
- config
- config.json
- passport.json
- controllers
- models
- routes
- .env
- .env.development
- .gitignore
- package-lock.json
- package.json
- server.js
Server package.json
{
"name": "traveler",
"version": "1.0.0",
"homepage": "http://dchicchon.github.io/Traveler",
"description": "A social media platform for people who love traveling and those who want to explore.",
"main": "server.js",
"scripts": {
"start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev",
"start:prod": "node server.js",
"start:dev": "concurrently \"nodemon --ignore 'client/*'\" \"npm run client\"",
"client": "cd client && npm run start",
"seed": "node scripts/seedDB.js",
"install": "cd client && npm install",
"build": "cd client && npm run build",
"heroku-postbuild": "npm run build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"aws-sdk": "^2.511.0",
"bcryptjs": "^2.4.3",
"concurrently": "^4.1.1",
"dotenv": "^8.0.0",
"express": "^4.17.1",
"express-session": "^1.16.2",
"gh-pages": "^2.0.1",
"multer": "^1.4.2",
"multer-s3": "^2.9.0",
"mysql2": "^1.6.5",
"passport": "^0.4.0",
"passport-local": "^1.0.0",
"sequelize": "^5.13.1"
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/dchicchon/Traveler.git"
},
"bugs": {
"url": "https://github.com/dchicchon/Traveler/issues"
}
}
Client package.json
{
"name": "traveler",
"version": "0.1.0",
"proxy": "https://travelersite.herokuapp.com/",
"private": true,
"dependencies": {
"axios": "^0.19.0",
"google-map-react": "^1.1.4",
"lodash": "^4.17.15",
"materialize-css": "^1.0.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-router-dom": "^5.0.1",
"react-scripts": "3.1.0",
"styled-components": "^4.3.2"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^2.1.1"
}
}
After entering the command heroku create and git push heroku master we would expect that our server will be pushed to heroku and our client will be deployed to gh-pages.
Does removing heroku-postbuild script from your backend package.json work?

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)

Cannot find module "d3" error is displayed after i upgraded my project from ionic 2 to ionic 3

I just upgraded my from ionic 2 to ionic 3. but now it is stuck at splash screen with error:
Cannot find module "d3"
here is my ionic info :
Cordova CLI: 6.4.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed
Package.json
{
"name": "MyApp",
"author": "",
"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": {
//dependencies starts here. have updated these according to ionic 3
"#angular/common": "4.0.0",
"#angular/compiler": "4.0.0",
"#angular/compiler-cli": "4.0.0",
"#angular/core": "4.0.0",
"#angular/forms": "4.0.0",
"#angular/http": "4.0.0",
"#angular/platform-browser": "4.0.0",
"#angular/platform-browser-dynamic": "4.0.0",
"#angular/platform-server": "2.2.1",
"#ionic-native/core": "^3.10.3",
"#ionic-native/keyboard": "^3.4.4",
"#ionic-native/splash-screen": "3.4.2",
"#ionic-native/status-bar": "3.4.2",
"#ionic/cloud-angular": "^0.10.0",
"#ionic/storage": "2.0.1",
"angular2-moment": "^1.1.0",
"google-libphonenumber": "^2.0.14",
"ionic-angular": "3.0.1",
"ionic-gallery-modal": "0.0.7",
"ionic-native": "2.2.11",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.0",
"#ionic/cli-plugin-cordova": "1.1.2",
"#ionic/cli-plugin-ionic-angular": "1.1.2",
"typescript": "2.1"
},
"cordovaPlugins": [
"ionic-plugin-keyboard",
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"cordova-sqlite-storage",
"cordova-plugin-x-toast",
"cordova-plugin-camera",
"cordova-plugin-compat",
"cordova-plugin-image-picker",
"cordova.plugins.diagnostic",
{
"id": "phonegap-plugin-push",
"locator": "phonegap-plugin-push",
"variables": {
"SENDER_ID": "XXXXXXXXXXX"
}
},
"cordova-plugin-appavailability",
"ionic-plugin-deploy",
"cordova-plugin-x-socialsharing",
"cordova-plugin-screen-orientation",
"com.hutchind.cordova.plugins.streamingmedia",
"cordova-plugin-contacts",
"ionic-plugin-deploy",
"cordova-plugin-x-socialsharing",
{
"locator": "https://github.com/napolitano/cordova-plugin-intent",
"id": "com.napolitano.cordova.plugin.intent"
},
"cordova-plugin-screen-orientation",
"cordova-plugin-file",
"cordova-plugin-file-transfer"
],
"cordovaPlatforms": [
{
"platform": "android",
"version": "",
"locator": "android"
}
],
"description": "An Ionic project"
}
Followed this link for the upgrade
Install d3 to package.json.
npm install d3 --save
Install the type declarations from npm:
npm install #types/d3 --save-dev
You dont need typings. It is deprecated.
The same for jquery.
used following set of commands to solve:
npm install d3#vSpecify_your_version --save
npm install -g typings --save
typings search d3 --save
typings install d3 --save
npm install jquery --save
typings install dt~jquery --global --save
npm install aws-sdk --save
Then delete the node_modules folder of your project and do npm install in your projects CMD/Terminal.

Resources