Dependencies were not found despite existing in package.json - javascript

EDIT: This question is related to #56558281 however it's two years old and hasn't been answered
I'm refactoring a few apps we have and tried moving a block of JS code from one NestJs app into another Nuxt app. After installing the dependencies I get this error:
These dependencies were not found: friendly-errors 11:04:41
friendly-errors 11:04:41
* child_process in ./node_modules/google-auth-library/build/src/auth/googleauth.js friendly-errors 11:04:41
* fs in ./node_modules/google-auth-library/build/src/auth/googleauth.js, ./node_modules/google-p12-pem/build/src/index.js and 4 others
friendly-errors 11:04:41
To install them, you can run: npm install --save child_process fs
I tried running npm install --save child_process fs without luck
Tried deleting node modules and clearing the cache then reinstalling with no luck
and I tried adding this block as per this answer without luck either
"browser":{
"child_process": false
}
Package.json
...
"dependencies": {
"#nuxt/types": "^2.14.5",
"#nuxtjs/apollo": "^4.0.1-rc.5",
"#nuxtjs/axios": "^5.12.5",
"#nuxtjs/gtm": "^2.2.2",
"#nuxtjs/vuetify": "^1.11.0",
"apollo-link-http": "^1.5.17",
"child_process": "^1.0.2",
"filestack-js": "^3.16.0",
"googleapis": "^39.2.0",
"google-auth-library": "^3.1.2",
"graphql": "^15.5.1",
"graphql-tag": "^2.12.5",
"isomorphic-fetch": "^3.0.0",
"net": "^1.0.2",
"nuxt": "^2.0.0",
"nuxt-i18n": "^6.12.2",
"nuxt-webfontloader": "^1.1.0",
"pluralize": "^8.0.0",
"readline": "^1.3.0",
"tls": "^0.0.1",
"typescript": "^3.0.0",
"url-slug": "^2.2.0",
"vue": "^2.6.11",
"vue-apollo": "^3.0.7",
"vue-infinite-loading": "^2.4.5",
"vuedraggable": "^2.24.3"
},
"devDependencies": {
"#mdi/font": "^5.3.45",
"#nuxt/typescript-build": "^2.0.3",
"#nuxtjs/eslint-config-typescript": "^3.0.0",
"#nuxtjs/eslint-module": "^2.0.0",
"#types/pluralize": "0.0.29",
"#vue/test-utils": "^1.0.0-beta.27",
"babel-eslint": "^10.0.1",
"babel-jest": "^26.0.1",
"deepmerge": "^4.2.2",
"eslint": "^7.9.0",
"eslint-plugin-nuxt": ">=0.4.2",
"eslint-plugin-prettier": "^3.0.1",
"fibers": "^5.0.0",
"jest": "^26.0.1",
"pug": "^2.0.3",
"pug-plain-loader": "^1.0.0",
"sass": "^1.26.11",
"sass-loader": "^8.0.2",
"typed-graphqlify": "^2.2.3",
"vue-class-component": "^7.1.0",
"vue-jest": "^4.0.0-beta.3",
"vue-property-decorator": "^9.0.0"
},
"browser":{
"child_process": false
}

Related

Invalid Podfile file: "react-native-community/cli" type of error

I am failing to install iOS dependencies using pod install annd after pressing enter button to run pod install.
Node Version: v16.16.0
NPM Version: 8.11.0
Working Process which I followed:
First way to install pod: Firstly install npm then install pod
Second way to install pod: after deleting node_modules then run pod install
Failed to install to follow the both of rules as mentioned before and to check the error, please check the attached file.
The dependencies are install in our projects as given below as package.json file.
{
"name": "shohan",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-async-storage/async-storage": "^1.16.2",
"#react-native-community/blur": "^3.6.0",
"#react-native-community/cli-platform-ios": "^8.0.6",
"#react-native-community/clipboard": "^1.5.1",
"#react-native-community/datetimepicker": "^6.1.2",
"#react-native-masked-view/masked-view": "^0.2.6",
"#react-native-picker/picker": "^2.4.2",
"#react-navigation/bottom-tabs": "^6.2.0",
"#react-navigation/material-top-tabs": "^6.2.1",
"#react-navigation/native": "^6.0.8",
"#react-navigation/native-stack": "^6.5.0",
"#rneui/base": "^0.0.0-edge.2",
"#rneui/themed": "^0.0.0-edge.2",
"#twotalltotems/react-native-otp-input": "^1.3.11",
"axios": "^0.26.1",
"moment": "^2.29.2",
"radio-buttons-react-native": "^1.0.4",
"react": "17.0.2",
"react-hook-form": "^7.28.1",
"react-native": "0.67.3",
"react-native-animatable": "^1.3.3",
"react-native-audio-record": "^0.2.2",
"react-native-bar-chart": "^0.1.0",
"react-native-countdown-component": "^2.7.1",
"react-native-date-picker": "^4.2.0",
"react-native-datepicker": "^1.7.2",
"react-native-dropdown-picker": "^5.3.0",
"react-native-elevation": "^1.0.0",
"react-native-emoji-selector": "^0.2.0",
"react-native-fs": "^2.20.0",
"react-native-image-picker": "^4.8.4",
"react-native-infinite-scrolling": "^2.0.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.5.6",
"react-native-loading-spinner-overlay": "^3.0.0",
"react-native-pager-view": "^5.4.15",
"react-native-paper": "^4.12.1",
"react-native-picker-select": "^8.0.4",
"react-native-pure-chart": "^0.0.24",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "^4.1.2",
"react-native-screens": "^3.13.1",
"react-native-skeleton-placeholder": "^5.0.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-sound": "^0.11.2",
"react-native-step-indicator": "^1.0.3",
"react-native-super-grid": "^4.4.0",
"react-native-svg": "^12.4.0",
"react-native-swiper-flatlist": "^3.0.16",
"react-native-tab-view": "^3.1.1",
"react-native-text-gradient": "^0.1.7",
"react-native-vector-icons": "^9.1.0",
"react-native-video": "^2.3.1",
"react-native-video-player": "^0.12.0",
"react-native-webview": "^11.18.1",
"react-native-youtube-iframe": "^2.2.2",
"socket.io-client": "^4.5.1"
},
"devDependencies": {
"#babel/core": "^7.17.5",
"#babel/runtime": "^7.17.2",
"#react-native-community/eslint-config": "^3.0.1",
"babel-jest": "^27.5.1",
"eslint": "^8.11.0",
"jest": "^27.5.1",
"metro-react-native-babel-preset": "^0.69.0",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
Here is the Podfile's code is given below,
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target 'shohan' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
target 'shohanTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
The occurred error is given in the attached file please check it and help me.

I'm creating an NPM Package. How do install 'peerDependency' when a user installs my NPM package?

I'm having an issue with react-native-vector-icons. I have it install as a dependency and peerDependency, but when I install my NPM Package into a project, I'm getting an error. To my understanding, a peerDependency is a dependency used for npm packages so packages of my NPM library are installed. Is that correct?
In my NPM library, I have manually linked react-native-vector-icons in my podfile and info.plist:
podfile
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
info.plist
<key>UIAppFonts</key>
<array>
<string>AntDesign.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Octicons.ttf</string>
<string>Zocial.ttf</string>
</array>
package.json
"dependencies": {
"react-native-iphone-x-helper": "^1.2.1",
"react-native-modal": "^11.5.3",
"react-native-vector-icons": "^6.6.0"
},
"devDependencies": {
"#babel/core": "^7.6.2",
"#babel/runtime": "^7.6.2",
"#react-native-community/eslint-config": "^0.0.5",
"#types/jest": "^24.0.24",
"#types/react-native": "^0.60.25",
"#types/react-native-vector-icons": "^6.4.5",
"#types/react-test-renderer": "16.9.1",
"#typescript-eslint/eslint-plugin": "^2.12.0",
"#typescript-eslint/parser": "^2.12.0",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react": "16.9.0",
"react-native": "0.61.5",
"react-test-renderer": "16.9.0",
"typescript": "^3.7.3"
},
"peerDependencies": {
"react": "*",
"react-native": "*",
"react-native-iphone-x-helper": "^1.2.1",
"react-native-modal": "^11.5.3",
"react-native-vector-icons": "^6.6.0"
},

Babel-Loader Error Plugin/Preset files are not allowed to export objects, only functions

After updating all my outdated npm packages to #latest, my electron app fails to start, giving the error
ERROR in ./src/index.js
[0] Module build failed (from ./node_modules/babel-loader/lib/index.js):
[0] Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/nyxynyx/foobar/node_modules/babel-preset-stage-0/lib/index.js
Any idea what went wrong? Thank you everyone!
.babelrc
{
"presets": ["env", "stage-0", "react"],
"plugins": [
"babel-plugin-styled-components",
"react-hot-loader/babel",
["transform-class-properties", { "loose": true }]
]
}
package.json (dependencies & devDependencies)
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.21",
"#fortawesome/free-solid-svg-icons": "^5.10.1",
"#fortawesome/react-fontawesome": "^0.1.4",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"babel-plugin-styled-components": "^1.10.6",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.26.0",
"bootstrap": "^4.3.1",
"css-loader": "^3.2.0",
"electron-log": "^3.0.7",
"electron-updater": "^4.1.2",
"file-loader": "^4.2.0",
"firebase": "^6.3.4",
"fix-path": "^2.1.0",
"json-loader": "^0.5.7",
"lodash": "^4.17.15",
"menubar": "^6.0.7",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-redux": "^7.1.0",
"react-redux-firebase": "^2.3.0",
"reactstrap": "^8.0.1",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"style-loader": "^1.0.0",
"styled-components": "^4.3.2",
"typeface-open-sans": "0.0.75",
"url-loader": "^2.1.0"
},
"devDependencies": {
"concurrently": "^4.1.1",
"devtron": "^1.4.0",
"electron": "^6.0.1",
"electron-builder": "^21.2.0",
"electron-debug": "^3.0.1",
"electron-devtools-installer": "^2.2.4",
"eslint": "^6.1.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-import-resolver-webpack": "^0.11.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"express": "^4.17.1",
"react-dom": "^16.8.6",
"react-hot-loader": "^4.12.10",
"react-router": "^5.0.1",
"react-router-dom": "^5.0.1",
"stylelint": "^10.1.0",
"stylelint-config-standard": "^18.3.0",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.39.1",
"webpack-dev-middleware": "^3.7.0",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.1"
},
Using node v12.6.0 on Mac OS X Mojave 10.14.5
I am moving my answer from comment due to lack of space there :)
Try using new packages for babel-core, babel-register and presets, replacing the old ones since they are depricated (babel-core, babel-presets-env, etc):
#babel/core - https://www.npmjs.com/package/#babel/core,
#babel/presets-env - https://babeljs.io/docs/en/babel-preset-env,
#babel/presets-react - https://babeljs.io/docs/en/babel-preset-react,
#babel/presets-stage-0 https://babeljs.io/docs/en/babel-preset-stage-0,
#babel/polyfill - https://babeljs.io/docs/en/babel-polyfill and
#babel/register - https://babeljs.io/docs/en/babel-register.
Then try deleting package.lock, and running again npm i . If that is not helping you can also try deleting node_modules folder, and running npm i again
babel-preset-env / babel-preset-react packages are deprecated.
use #babel/preset-env and #babel/preset-react packages.
And do the following change in .babelrc :
"presets": ["#babel/env", "#babel/react"]
That is due to outdated babel packages being used. The babel project, just like most other active Javascript projects, have moved on to using scope packages. Hence, the package names starts with #babel
Check this to fix issue

Webpack Error: please install sqlite3 package manually

I'm building an application with Electron and Sequelize. I started to configure my database, then, I've received this error:
Uncaught Error: Please install sqlite3 package manually
at new ConnectionManager (/home/matheusdrdj/Documentos/Git/personal-
management/node_modules/sequelize/lib/dialects/sqlite/con…:31)
at new SqliteDialect (/home/matheusdrdj/Documentos/Git/personal-
management/node_modules/sequelize/lib/dialects/sqlite/ind…:14)
at new Sequelize (/home/matheusdrdj/Documentos/Git/personal-
management/node_modules/sequelize/lib/sequelize.js:239)
at eval (index.js?17a5:3)
at Object. (renderer.js:1084)
at webpack_require (renderer.js:680)
at fn (renderer.js:90)
at eval (index.js?21f1:1)
at Object. (renderer.js:1077)
at webpack_require (renderer.js:680)
at fn (renderer.js:90)
at eval (main.js?3b76:1)
at Object. (renderer.js:918)
at webpack_require (renderer.js:680)
at fn (renderer.js:90)
at Object. (renderer.js:835)
at webpack_require (renderer.js:680)
at renderer.js:726
at renderer.js:729
I have installed sqlite3 globally and localy, tested it on the console and it's working fine. But, my application doesn't even load the screen.
My dependencies:
"dependencies": {
"axios": "^0.16.1",
"sequelize": "^4.37.7",
"sqlite3": "^4.0.0",
"vue": "^2.4.2",
"vue-electron": "^1.0.6",
"vue-router": "^2.5.3",
"vuetify": "1.0.0",
"vuex": "^2.3.1"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.24.1",
"babili-webpack-plugin": "0.1.2",
"cfonts": "^1.1.3",
"chalk": "^2.1.0",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.4",
"del": "^3.0.0",
"devtron": "^1.4.0",
"electron": "^1.7.5",
"electron-builder": "^19.19.1",
"electron-debug": "^1.4.0",
"electron-devtools-installer": "^2.2.0",
"electron-rebuild": "^1.7.3",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"html-webpack-plugin": "^2.30.1",
"js-sha256": "^0.9.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"style-loader": "^0.18.2",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"url-loader": "^0.5.9",
"vue-html-loader": "^1.2.4",
"vue-loader": "^13.0.5",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.4.2",
"webpack": "^3.5.2",
"webpack-dev-server": "^2.7.1",
"webpack-hot-middleware": "^2.18.2"
}
I cannot figure out what is happening.
With Electron sqlite3 has to be built with electron-builder.
How to use sqlite3 module with electron?
and https://github.com/electron-userland/electron-builder
both recommend adding this to your package.json
"postinstall": "electron-builder install-app-deps"
This will rebuild all native binaries everytime you install a new package.

ReactNative: babelHelpers.typeof is not a function

On an existing project, that have worked fine over many months and which is already in the AppStores for both iOS and Android, we've got now a break on development with this error:
babelHelpers.typeof is not a function
All what we've done was to try to upgrade an RN-0.26-based Application to a newer version. But even after a rollback the error remains.
We cleared watchman, resetted the packager multiple times. Nothing helped here.
Our package.json looks like this:
{
"version": "0.0.1",
"private": true,
"scripts": {
"reset": "rm -rf node_modules/ && npm cache clear && watchman watch-del-all && npm i",
"start": "node node_modules/react-native/local-cli/cli.js start --reset-cache",
"testflight": "fastlane beta",
"android-device": "adb reverse tcp:8081 tcp:8081 && react-native run-android",
"lint": "jslint **.js",
"test": "mocha test/",
"generate-apk": "cd android && ./gradlew assembleRelease && open ./app/build/outputs/apk/",
"install-apk": "cd android && ./gradlew installRelease",
},
"devDependencies": {
"jshint": "latest",
"mocha": "latest",
"eslint": "^2.3.0",
"eslint-config-standard": "^5.1.0",
"eslint-config-standard-react": "^2.3.0",
"eslint-plugin-promise": "^1.1.0",
"eslint-plugin-react": "^4.1.0",
"eslint-plugin-react-native": "^1.0.0",
"eslint-plugin-standard": "^1.3.2"
},
"dependencies": {
"apsl-react-native-button": "^2.5.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"es6-promisify": "^4.1.0",
"fetch-stuff": "^1.0.1",
"iap-receipt-validator": "^1.0.2",
"immutable": "^3.8.1",
"js-sha256": "^0.3.0",
"keymirror": "^0.1.1",
"lodash.difference": "^4.3.0",
"lodash.find": "^4.4.0",
"lodash.partialright": "^4.1.4",
"lodash.remove": "^4.5.0",
"lodash.shuffle": "^4.0.0",
"lodash.uniq": "^4.3.0",
"moment": "^2.14.1",
"normalizr": "^2.1.0",
"react": "15.0.2",
"react-native": "0.26.2",
"react-native-animatable": "^0.6.1",
"react-native-app-intro": "^1.0.2",
"react-native-billing": "^1.3.0",
"react-native-code-push": "^1.12.2-beta",
"react-native-code-push-saga": "^1.0.0",
"react-native-console-panel": "0.0.9",
"react-native-debug-stylesheet": "^0.1.1",
"react-native-drawer": "file:./custom_modules/react-native-drawer",
"react-native-extra-dimensions-android": "^0.17.0",
"react-native-fabric": "^0.2.3",
"react-native-fetch-blob": "^0.4.2",
"react-native-fs": "^1.4.0",
"react-native-gifted-spinner": "0.0.4",
"react-native-google-analytics-bridge": "^2.1.0",
"react-native-htmlview": "^0.5.0",
"react-native-i18n": "0.0.8",
"react-native-image-progress": "^0.5.0",
"react-native-in-app-utils": "^4.0.0",
"react-native-keyboard-aware-scroll-view": "^0.1.0",
"react-native-navbar": "^1.5.0",
"react-native-router-flux": "^3.30.0",
"react-native-search-bar": "^2.11.0",
"react-native-side-menu": "^0.19.0",
"react-native-simple-store": "^1.0.1",
"react-native-sound": "^0.8.3",
"react-native-sqlite-storage": "^2.1.6",
"react-native-swiper": "^1.4.4",
"react-native-vector-icons": "^2.0.2",
"react-redux": "^4.4.5",
"react-timer-mixin": "^0.13.3",
"redux": "^3.5.2",
"redux-form": "^6.0.0-alpha.15",
"redux-logger": "^2.6.1",
"redux-saga": "^0.10.4",
"redux-thunk": "^2.1.0",
"reselect": "^2.5.1",
"rn-viewpager": "^1.1.2",
"rnpm": "^1.7.0",
"tween-functions": "^1.2.0"
}
}
Can anyone help?
The issue happens because either your project (via a custom .babelrc) or one of your dependencies is relying on a es2015 preset that doesn't work with React Native. The reason for that is because it includes transform-typeof-symbol which calls babelHelpers.typeof that is not bundled with React Native.
If you have a custom babelrc - the solution is simple, just remove this preset.
Afterwards, restart packager w/o cache and you should be set.
Note: It maybe one of your dependencies that uses that preset - in such case, there's nothing you can do but try forking it and removing the preset yourself.
A part solution to this is using babel-preset-react-native-stage-0
https://www.npmjs.com/package/babel-preset-react-native-stage-0
There is a PR here to fix this in the react-native codebase: enter link description here

Categories