Im trying to setup a next js with native base and following the instructions, I am getting this.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: next-latest#undefined
npm ERR! Found: next#12.0.4
npm ERR! node_modules/next
npm ERR! next#"12.0.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer next#"^11" from #expo/next-adapter#3.1.10
npm ERR! node_modules/#expo/next-adapter
npm ERR! dev #expo/next-adapter#"^3.1.10" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Zacha\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Zacha\AppData\Local\npm-cache\_logs\2022-01-20T00_16_08_660Z-debug-0.log
Aborting installation.
npm install has failed.
Try Following Steps.
Downgrade your next to 11
npm install next#11
Changes next.config.js to following code.
const { withExpo } = require('#expo/next-adapter');
const withPlugins = require('next-compose-plugins');
const withTM = require('next-transpile-modules')([
'native-base',
'react-native-svg',
'react-native-safe-area-context',
'#react-aria/visually-hidden',
'#react-native-aria/button',
'#react-native-aria/checkbox',
'#react-native-aria/combobox',
'#react-native-aria/focus',
'#react-native-aria/interactions',
'#react-native-aria/listbox',
'#react-native-aria/overlays',
'#react-native-aria/radio',
'#react-native-aria/slider',
'#react-native-aria/tabs',
'#react-native-aria/utils',
'#react-stately/combobox',
'#react-stately/radio',
]);
module.exports = withPlugins(
[withTM, [withExpo, { projectRoot: __dirname }], { webpack5: true }],
{
webpack: config => {
config.resolve.alias = {
...(config.resolve.alias || {}),
// Transform all direct `react-native` imports to `react-native-web`
'react-native$': 'react-native-web',
};
config.resolve.extensions = [
'.web.js',
'.web.ts',
'.web.tsx',
...config.resolve.extensions,
];
return config;
},
}
);
Add import React from 'react'; to _app.js.
Related
I needed to update backend model, so I entered the npm run update-model command but it returns an error:
events.js:292
throw er; // Unhandled ‘error’ event
^
Error: connect ECONNREFUSED 127.0.0.1:*****
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
Emitted ‘error’ event on ClientRequest instance at:
at Socket.socketErrorListener (_http_client.js:469:9)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -61,
code: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘127.0.0.1’,
port: ******
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project2 update-model: gen-cuba-front sdk:all --dest src/cuba
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project2 update-model script.
Probably in Studio integration flag isn't turned on.
Use main menu -> File -> Settings -> CUBA -> Enable integration.
I have a gatsby portfolio application and had to do some updates to it. Then cloned it from github and had to install dependencies. When i run npm install i have the error log below:
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint-plugin-flowtype#undefined
npm WARN node_modules/eslint-plugin-flowtype
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-flowtype#"3.x || 4.x" from eslint-config-react-app#5.2.1
npm WARN node_modules/eslint-config-react-app
npm WARN eslint-config-react-app#"^5.2.1" from gatsby#2.32.13
npm WARN node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint-plugin-react#undefined
npm WARN node_modules/eslint-plugin-react
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-react#"7.x" from eslint-config-react-app#5.2.1
npm WARN node_modules/eslint-config-react-app
npm WARN eslint-config-react-app#"^5.2.1" from gatsby#2.32.13
npm WARN node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint-plugin-react-hooks#undefined
npm WARN node_modules/eslint-plugin-react-hooks
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-react-hooks#"1.x || 2.x" from eslint-config-react-app#5.2.1
npm WARN node_modules/eslint-config-react-app
npm WARN eslint-config-react-app#"^5.2.1" from gatsby#2.32.13
npm WARN node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: graphql#undefined
npm WARN node_modules/graphql
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql#"^14.4.1" from express-graphql#0.9.0
npm WARN node_modules/express-graphql
npm WARN express-graphql#"^0.9.0" from gatsby#2.32.13
npm WARN node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: graphql#undefined
npm WARN node_modules/gatsby-source-strapi/node_modules/graphql
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql#"^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0" from express-graphql#0.6.12
npm WARN node_modules/gatsby-source-strapi/node_modules/express-graphql
npm WARN express-graphql#"^0.6.6" from gatsby#1.9.279
npm WARN node_modules/gatsby-source-strapi/node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: graphql#undefined
npm WARN node_modules/gatsby-source-strapi/node_modules/gatsby/node_modules/graphql
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql#"^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0" from graphql-relay#0.5.5
npm WARN node_modules/gatsby-source-strapi/node_modules/gatsby/node_modules/graphql-relay
npm WARN graphql-relay#"^0.5.1" from gatsby#1.9.279
npm WARN node_modules/gatsby-source-strapi/node_modules/gatsby
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/axios reason: Unexpected end of JSON input
I have cleared the cache using npm cache clean --force and ran npm install again but I still have same error....
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/axios reason: Unexpected end of JSON input
Any help how I can fix this issue would be greatly appreciated.
package.json file
{
"name": "gatsby-starter-hello-world",
"private": true,
"description": "A simplified bare-bones starter for Gatsby",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"dependencies": {
"gatsby": "^2.21.0",
"gatsby-image": "^2.4.0",
"gatsby-plugin-react-helmet": "^3.3.1",
"gatsby-plugin-webfonts": "^1.1.3",
"gatsby-plugin-sharp": "^2.6.0",
"gatsby-plugin-sitemap": "^2.4.2",
"gatsby-source-filesystem": "^2.3.0",
"gatsby-source-strapi": "0.0.12",
"gatsby-transformer-sharp": "^2.5.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "^6.0.0",
"react-icons": "^3.10.0",
"react-markdown": "^4.3.1"
},
"devDependencies": {
"prettier": "2.0.5"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
This is not a problem from your side. It is not a problem of package.json. In the ERR, the URL https://registry.npmjs.org/axios (last line of the error message) gives a JSON response which is flawed. See the below image. The JSON validation fails. They must resolve this.
Try running
npm cache clean --force
npm cache verify
yarn
Or try uninstalling and then reinstalling.
EDIT:
Delete the node_modules folder and the lock file. Then try running yarn
If you don't have yarn installed install it by using
npm i -g yarn
Check the installation using
yarn --version
This is the error I got on running npm start:
F:\Works\Projects\Node\Voice_pres_withbackend\api\node_modules\express\lib\router\index.js:458
throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))
^
TypeError: Router.use() requires a middleware function but got a string
at Function.use (F:\Works\Projects\Node\Voice_pres_withbackend\api\node_modules\express\lib\router\index.js:458:13)
at Function.<anonymous> (F:\Works\Projects\Node\Voice_pres_withbackend\api\node_modules\express\lib\application.js:220:21)
at Array.forEach (<anonymous>)
at Function.use (F:\Works\Projects\Node\Voice_pres_withbackend\api\node_modules\express\lib\application.js:217:7)
at Object.<anonymous> (F:\Works\Projects\Node\Voice_pres_withbackend\api\app.js:25:5)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! api#0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the api#0.0.0 start 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\HP\AppData\Roaming\npm-cache\_logs\2020-09-21T14_50_24_855Z-debug.log
This is part of the code the error is pointing to :
var express = require("express");
var router = express.Router();
router.get("/", function (req, res) {
res.send("Api successful");
});
module.exports = router;
Can you please tell me what it is that I'm doing wrong?
I am working at this project https://github.com/ameCont/vue.git
Index.js file:
const fs = require('fs')
const path = require('path')
const Sequelize = require('sequelize')
const config = require('../config/config')
const db = {}
//console.log(config)
const sequelize = new Sequelize(
config.db.database,
config.db.user,
config.db.password,
config.db.options
)
fs
.readdirSync(__dirname)
.filter((file) => {
file !== 'index.js'
}
)
.forEach((file) => {
const model = sequelize.import(path.join(__dirName, file))
db[model.name] = model
})
db.sequelize = sequelize
db.Sequelize = Sequelize
module.exports = db
When I run
npm start
inside server directory I get the error
/home/ubuntu/vue/server/src/models/index.js:10
config.db.database,
^
TypeError: Cannot read property 'database' of undefined
at Object.<anonymous> (/home/ubuntu/vue/server/src/models/index.js:10:15)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/ubuntu/vue/server/src/app.js:7:21)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
[nodemon] app crashed - waiting for file changes before starting...
My config.js file contains:
module.exports = {
port: process.env.PORT || 8081,
db: {
database: process.env.DB_NAME || 'vue',
user: process.env.DB_USER || 'vue',
password: process.env.DB_PASS || 'vue',
options: {
dialect: process.env.DIALECT || 'sqlite',
host: process.env.HOST || 'localhost',
storage: 'vue.sqlite.sql'
}
}
}
It has || 'vue' so it shouldn't need a real database (I created one but the issue is the same)
I am beginner with vue.
Here JS: firebase.init error: TypeError: Cannot read property 'database' of undefined, the solution was to install some plugins.
But in my case which plugins?
If it helps, when I run
npm install sqlite3
I get this
> sqlite3#4.2.0 install /home/ubuntu/vue/server/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for sqlite3#4.2.0 and node#10.19.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/ubuntu/vue/server/node_modules/sqlite3/build'
gyp ERR! System Linux 5.4.0-26-generic
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "configure" "--fallback-to-build" "--module=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /home/ubuntu/vue/server/node_modules/sqlite3
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/bin/node-gyp configure --fallback-to-build --module=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/ubuntu/vue/server/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 5.4.0-26-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/ubuntu/vue/server/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/ubuntu/vue/server/node_modules/sqlite3
node-pre-gyp ERR! node -v v10.19.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/bin/node-gyp configure --fallback-to-build --module=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/ubuntu/vue/server/node_modules/sqlite3/lib/binding/node-v64-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm WARN eslint-plugin-import#2.20.2 requires a peer of eslint#2.x - 6.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-vue#6.2.2 requires a peer of eslint#^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.17.1 requires a peer of typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN server#1.0.0 No description
npm WARN server#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3#4.2.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3#4.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Also, this topic doesn't help TypeError: Cannot read property 'database' of undefined
because I do have const config = require('../config/config')
Thanks for help!
Actually, in your config you have two exports, so for correctly accessing it you should name the exported objects:
module.exports.config = {
port: process.env.PORT || 8081,
db: {
database: process.env.DB_NAME || 'vue',
user: process.env.DB_USER || 'vue',
password: process.env.DB_PASS || 'vue',
options: {
dialect: process.env.DIALECT || 'sqlite',
host: process.env.HOST || 'localhost',
storage: 'vue.sqlite.sql'
}
}
}
module.exports.otherConfigs = {
// other configs ..
}
Then in model's index.js you import the configs like that:
const { config, otherConfigs } = require('../config/config')
I'm attempting to update our angular 5 application to angular 6, and am running into a build issue currently with awesome-typescript loader.
The full error message is
C:\source\ProjectFolder\Angular.Web.App\node_modules\awesome-typescript-loader\src\watch-mode.ts:5
compiler.hooks.run.tapAsync('at-loader', function(params, callback) {
^
TypeError: Cannot read property 'run' of undefined
at CheckerPlugin.apply (C:\source\ProjectFolder\Angular.Web.App\node_modules\awesome-typescript-loader\src\watch-mode.ts:5:18)
at Compiler.apply (C:\source\ProjectFolder\Angular.Web.App\node_modules\tapable\lib\Tapable.js:375:16)
at webpack (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:33:19)
at options.map.options (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:23:55)
at Array.map (<anonymous>)
at webpack (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:23:40)
at processOptions (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:335:15)
at yargs.parse (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:397:2)
at Object.Yargs.self.parse (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\node_modules\yargs\yargs.js:533:18)
at Object.<anonymous> (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:152:7)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Angular.Web.App#1.0.0-rc3 build:webpack: `webpack --progress --color`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Angular.Web.App#1.0.0-rc3 build:webpack 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\UserAccount\AppData\Roaming\npm-cache\_logs\2019-06-20T21_07_09_890Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Angular.Web.App#1.0.0-rc3 build:dev: `npm run build:vendor && npm run build:webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Angular.Web.App#1.0.0-rc3 build: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\UserAccount\AppData\Roaming\npm-cache\_logs\2019-06-20T21_07_09_936Z-debug.log
it is required, as our webpack is pulling in its CheckerPlugin
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
module.exports = (env) => {
// Configuration in common to both client-side and server-side bundles
const isDevBuild = !(env && env.prod);
const sharedConfig = {
stats: { modules: false },
context: __dirname,
resolve: { extensions: [ '.js', '.ts' ] },
output: {
filename: '[name].js',
publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
},
module: {
rules: [
{ test: /\.ts$/, use: isDevBuild ? ['angular2-template-loader', 'angular2-router-loader'] : '#ngtools/webpack' },
{ test: /\.html$/, use: 'html-loader?minimize=false' },
{ test: /\.css$/, use: [ 'to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize' ] },
{ test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' },
...sharedModuleRules
]
},
plugins: [new CheckerPlugin()]
};
currenlty using awesome-typescript-loader v. 5.0.0