NativeBase setup/installation error - node.js

I am trying to setup/install Native-Base in my React-Native project using the official document. But getting error every time.
Command: npm install native-base --save
Error:
npm ERR! Unexpected end of JSON input while parsing near '...yish/-/is-arrayish-0.'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/abhijitsrivastava/.npm/_logs/2018-07-04T06_03_24_057Z-debug.log
System Specification:
node --version
v8.1.0
npm --version
6.0.0
react-native --version
react-native-cli: 2.0.1
react-native: 0.55.4
Machine: Ubuntu 16.04LTS
IDE: Visual Studio Code Version 1.23.0
As per the compatibility matrix every thing is looking OK. I don't know how can I fix it.
Update :
Here is my package.json file.
{
"name": "xyz",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "^0.55.4",
"react-navigation": "^2.3.1",
"redux": "^4.0.0"
},
"devDependencies": {
"babel-jest": "23.0.1",
"babel-preset-react-native": "4.0.0",
"jest": "23.1.0",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}

I have noticed in a recent forum post where they've recommeneded to use yarn in place of npm for installing the dependencies and for creating the react native app.
Yarn: https://yarnpkg.com/en/docs/install#windows-stable
After installing yarn try issuing the below command,
yarn add native-base --save
Hope this helps!

Tried on same lines, no issues
{
"name": "NativebaseKitchenSink",
"version": "2.5.2",
"private": true,
"devDependencies": {
"babel-eslint": "7.2.3",
"eslint": "4.4.1",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "6.0.2",
"eslint-plugin-prettier": "2.1.2",
"eslint-plugin-react": "7.1.0",
"eslint-plugin-react-native": "3.0.1",
"flow-bin": "0.52.0",
"flow-typed": "2.1.5",
"husky": "0.14.3",
"jest": "20.0.4",
"jest-expo": "25.0.0",
"prettier": "1.5.3",
"react-test-renderer": "16.3.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"color": "1.0.3",
"lodash": "4.13.1",
"moment": "2.13.0",
"native-base": "^2.6.1",
"react": "16.3.1",
"react-native": "0.55.4",
"react-navigation": "1.5.0"
}
}

To solve this issue you can try to change your node js version
npm install native-base this is giving issue with 18.7.0 version but
change to
version 16.16.0 LTS for this it is working properly
https://nodejs.org/en/

Related

Next.js error cannot find module 'next/headers'

Faced this issue when I was using login functionality developed by my teammate in a group project and apparently I am the only one facing this issue.
npm version: 8.19.3
node version: 16.17.0
package.json :-
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "npm run prettify && next dev",
"build": "npm run prettify && next build",
"start": "next start",
"lint": "npm run prettify && next lint",
"prettify": "prettier --write \"**/*.{js, jsx}\""
},
"dependencies": {
"#emotion/react": "11.10.4",
"#emotion/server": "11.10.0",
"#emotion/styled": "11.10.4",
"#mui/icons-material": "5.10.6",
"#mui/material": "5.10.6",
"#mui/x-date-pickers": "^5.0.3",
"cryptr": "^6.0.3",
"dayjs": "^1.11.5",
"intl": "^1.2.5",
"mui-file-dropzone": "^4.0.2",
"next": "12.2.5",
"next-auth": "^4.12.0",
"normalize.css": "^8.0.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-share": "^4.4.1",
"react-toastify": "^9.0.8",
"swr": "^1.3.0",
"universal-cookie": "^4.0.4"
},
"devDependencies": {
"eslint": "8.23.1",
"eslint-config-next": "12.3.1",
"eslint-config-prettier": "8.5.0",
"prettier": "2.7.1"
}
}
Error :-
error - Error: Cannot find module 'next/headers'
I have tried deleting the node_modules and .next folders but I am still facing this issue.
That is when you update Nextjs to version 13 with next-auth, which is intended for next#13 users, in your case using version 12 yet, the root cause the error in v4.12.x with next/headers package from next#12, so it could be to support getting the session in React Server Components for example.
Edit package.json, it should fix your issue:
{
"next-auth": "4.15.1"
}

Why aws app runner looks trying to build packages on node 12 even if node 14 is selected?

I'm trying to generate a build of our Next.js application that is on a Github repository. We used node 14.19.3 to build the application, and it runs fine on local development.
The package.json of main project is
{
"name": "example-name",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"#apollo/client": "^3.6.4",
"graphql": "^16.5.0",
"#our-private-package": "^1.0.7",
"framer-motion": "^2.9.4",
"i18next": "^21.8.0",
"js-cookie": "^2.2.1",
"next": "^12.1.6",
"next-cookies": "^2.0.3",
"ni18n": "^1.0.3",
"prop-types": "^15.7.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-ga": "^3.3.0",
"react-i18next": "^11.16.9",
"react-icons": "^4.3.1",
"react-modal": "^3.11.2",
"react-redux": "^7.2.1",
"react-slick": "^0.27.11",
"react-slider": "^2.0.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"sass": "^1.26.11",
"slick-carousel": "^1.8.1"
},
"devDependencies": {
"#ermeschultz/chai-arrays": "^2.3.0",
"chai": "^4.2.0",
"eslint": "^7.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.0.0",
"esm": "^3.2.25",
"file-loader": "^6.1.0",
"mocha": "^8.1.3",
"prettier": "^2.1.1",
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
"url-loader": "^4.1.0"
}
}
Our private package have this package.json file:
{
"name": "#our-private-package",
"version": "1.0.7",
...
"engines": {
"yarn": ">=1.22.0",
"npm": ">=6.14.16",
"node": ">=14"
},
"scripts": {
"prepare": "npm run build",
"start": "node ./build/index.js",
"dev": "ts-node ./src/index.ts",
"build": "tsc --module commonjs"
},
"dependencies": {
"canvas": "^2.9.1",
"canvas-5-polyfill": "^0.1.5"
},
"devDependencies": {
"#types/node": "^17.0.33",
"#types/react": "^17.0.39",
"#types/react-dom": "^17.0.3",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"ts-node": "^10.7.0",
"typescript": "^4.6.4"
},
"peerDependencies": {
"react": "^17.0.0",
"react-dom": "^17.0.0"
}
}
To create the service, I selected nodejs 14 platform and put these build commands in the app runner user interface:
export VARIABLE=value; npm install; npm run build
*The variable is an env variable necessary to import some private packages.
And this running commands in the app runner user interface:
npm start
The build logs show the message:
"[Build] \u001b[0m\u001b[91mError: The module '/app/node_modules/canvas/build/Release/canvas.node'\n",
"[Build] was compiled against a different Node.js version using\n",
"[Build] NODE_MODULE_VERSION 72. This version of Node.js requires\n",
"[Build] NODE_MODULE_VERSION 83. Please try re-compiling or re-installing\n",
I removed the private package and then project builds successfully on app runner. But I just can't reproduce the same problem on my local machine.
The error on message was reported previously on Stack Overflow, always relating to the use of another version of node than the current used one. It is always solved by reinstalling, rebuilding, and/or clearing the npm cache. But app runner creates the container from scratch.
The interface shows that we are using Node js 14 environment. But it seems running on the Node js 12 platform when running npm run build command. At least for the canvas module build.
It could be a package conflict case. But, why this shows the message like it was build in node 12? Why the same problem does not happens in my local development even if I'm using same node and npm present in App Runner?
It is not a definitive complete answer to the question, but run yarn install; yarn build instead npm make the same code runs on app runner.

Can't resolve dependency, refering to root project - next#"^9.5.6-canary.13, next-routes#"^1.4.2"

I am trying for hours to resolve this issue, running from one error to the next one…
Trying everything from --legacy-peer-deps, --force npm audit fix, at this point I am not even able to install my packages without running into errors, and I don't understand what that error is saying:
npm ERR! Found: next#9.5.6-canary.18
npm ERR! node_modules/next
npm ERR! next#"^9.5.6-canary.13" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer next#">=2" from next-routes#1.4.2
npm ERR! node_modules/next-routes
npm ERR! next-routes#"^1.4.2" from the root project
My package.json:
{
"name": "project-name",
"version": "0.1.0",
"private": true,
"main": "index.js",
"scripts": {
"test": "next dev",
"dev": "node server.js",
"build": "next build",
"start": "next start"
},
"dependencies": {
"#apollo/client": "^3.3.19",
"apollo-boost": "^0.4.9",
"babel-loader": "^8.2.2",
"babel-register": "^6.26.0",
"dotenv": "^8.2.0",
"framer-motion": "^4.0.0",
"fs": "0.0.1-security",
"graphql": "^15.5.0",
"https": "^1.0.0",
"ignore-loader": "^0.1.2",
"lazysizes": "^5.3.2",
"next": "^9.5.6-canary.13",
"next-routes": "^1.4.2",
"node-webvtt": "^1.9.3",
"path": "^0.12.7",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"sass": "^1.32.6",
"storyblok-js-client": "^4.0.5",
"url": "^0.11.0"
},
"devDependencies": {
"#babel/register": "^7.12.13",
"#types/node": "^14.14.37",
"#types/react": "^17.0.3",
"dotenv-webpack": "^6.0.0",
"typescript": "^4.2.4"
}
}
I am guessing some of the longer list of packages are not playing along with each other, but how can I investigate this further? The error is not very helpful. Also the similar combinations of packages and version seem to work fine in other projects …
The error originally complained about graphql packages I am using, after updating some versions it is now complaining about the next and next-routes packages …
Any ideas?

How to resolve gulp dependencies while creating a NPM package

I have a nodeJs application(demo) which using commander package to take command line argument and using gulp for
build
docs
test
coverage
This functionality is working fine but Now I need to move this application as a NPM Package.
Changes are done according to according NPM Package but when I install this as NPM package npm install ../demo/ from local location.
It asks for following gulp dependencies: -
Cannot find module gulp
Cannot find module gulp-load-plugins
Cannot find module del
Cannot find module gulp-plumber
Cannot find module gulp-eslint
Cannot find module babel-eslint
Cannot find module gulp-debug
Cannot find module gulp-sourcemaps
Cannot find module gulp-babel
Every time I go back to the npm package(which i created) directory and run the command which occurs as an error like npm install gulp --save-dev and npm install del --save-dev and so on.
I also defined these dependencies in package.json but it is still throwing errors.
Is there any way to resolve this issue.
package.json
{
"name": "demo",
"version": "0.0.1",
"description": "",
"main": "./dist/index.js",
"license": "SEE LICENSE IN LICENSE.md",
"keywords": [],
"scripts": {
"build": "gulp build",
"coverage": "gulp coverage",
"docs": "gulp docs",
"prepublish": "gulp build",
"test": "gulp test"
},
"dependencies": {
"autobind-decorator": "^1.3.3",
"babel-polyfill": "^6.6.1",
"commander": "^2.9.0",
"lodash": "^4.0.0",
"mustache": "^2.2.1",
"source-map-support": "^0.4.0",
"wrench": "^1.5.8",
"ms": "^0.7.1"
"babel-eslint": "^6.0.4",
"babel-plugin-lodash": "^2.2.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-nodejs-lts": "^1.2.2",
"chai": "^3.5.0",
"del": "^2.2.0",
"esdoc-es7-plugin": "^0.0.3",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-babel-istanbul": "^1.1.0",
"gulp-debug": "^2.1.2",
"gulp-esdoc": "^0.2.0",
"gulp-eslint": "^2.0.0",
"gulp-filter": "^4.0.0",
"gulp-inject-modules": "^0.1.1",
"gulp-load-plugins": "^1.2.2",
"gulp-mocha": "^2.2.0",
"gulp-plumber": "^1.1.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"sinon": "^1.17.4",
"sinon-chai": "^2.8.0",
"btoa": "^1.1.2",
"superagent": "^2.1.0"
},
"engines": {
"node": ">=4.0.0"
}
}
I put all the things in dependencies. I tried that way but having same problem.
npm install ../demo/
npm WARN package.json demo_project#1.0.0 No description
npm WARN package.json demo_project#1.0.0 No repository field.
npm WARN package.json demo_project#1.0.0 No README data
> demo#0.0.1 prepublish /work/demo
> gulp build
[16:53:33] Local gulp not found in ~/work/demo
[16:53:33] Try running: npm install gulp
Although the documentation doesn't mention it, npm install folder only installs dependencies and not devDependencies. This may be a little bit confusing as running npm install inside the package folder installs both dependenciesand devDependencies.
So try to install gulpand all the rest as npm install --save gulp (not
--save-dev)
UPDATE: after adding package.json:
everything under devDependencies in your package.json should be under dependencies:
{
"name": "demo",
"version": "0.0.1",
"description": "",
"main": "./dist/index.js",
"license": "SEE LICENSE IN LICENSE.md",
"keywords": [],
"scripts": {
"build": "gulp build",
"coverage": "gulp coverage",
"docs": "gulp docs",
"prepublish": "gulp build",
"test": "gulp test"
},
"dependencies": {
"autobind-decorator": "^1.3.3",
"babel-polyfill": "^6.6.1",
"commander": "^2.9.0",
"lodash": "^4.0.0",
"mustache": "^2.2.1",
"source-map-support": "^0.4.0",
"wrench": "^1.5.8",
"ms": "^0.7.1",
"babel-eslint": "^6.0.4",
"babel-plugin-lodash": "^2.2.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-nodejs-lts": "^1.2.2",
"chai": "^3.5.0",
"del": "^2.2.0",
"esdoc-es7-plugin": "^0.0.3",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-babel-istanbul": "^1.1.0",
"gulp-debug": "^2.1.2",
"gulp-esdoc": "^0.2.0",
"gulp-eslint": "^2.0.0",
"gulp-filter": "^4.0.0",
"gulp-inject-modules": "^0.1.1",
"gulp-load-plugins": "^1.2.2",
"gulp-mocha": "^2.2.0",
"gulp-plumber": "^1.1.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"sinon": "^1.17.4",
"sinon-chai": "^2.8.0",
"btoa": "^1.1.2",
"superagent": "^2.1.0"
},
"engines": {
"node": ">=4.0.0"
}
}

Install of jspm to ^0.16.34 has no registry property provided

I am fairly new to front end development and am working through Brian Noyes Aurelia Fundamentals course
I have installed the following;
node-v4.4.4x64
Git-2.8.2-64
Also I ran
npm install jspm --save-dev
and had this result
When I ran
npm install =g jspm gulp http-server
I got messages saying that the following are deprecated.
graceful-fs#3.0.8 and lodash#1.0.2
then when I ran
jsm init
I got an error
The package.json file is
{
"jspm": {},
"devDependencies": {
"jspm": "^0.16.34"
}
}
How do I fix this error?
Credit to user danzinator on github.
The fix:
Adding in the "registry": "npm" line to Package.json (even though the documentation says by default this registry should be used?)
{
"jspm": {
"registry": "npm",
"directories": {
"baseURL": "wwwroot",
"packages": "jspm_packages"
},
"devDependencies": {
"babel": "babel-core#^5.8.22",
"babel-runtime": "^5.8.20",
"browser-sync": "^2.9.3",
"core-js": "^1.1.0",
"gulp": "^3.9.0",
"gulp-tslint": "^3.2.0",
"jspm": "^0.16.2"
}
},
"devDependencies": {
"jspm": "^0.16.2",
"gulp": "^3.9.0",
"gulp-tslint": "^3.2.0",
"browser-sync": "^2.9.3"
}
}

Resources