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

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?

Related

npm ci failing on linux

Current behaviour:
I'm having a local development environment on mac from which I git push to my remote repo. My production server is on linxu and there I pull my repo. Usually this works fine but this time I'm stuck with an error I can't find a workaround for :(
npm ci failing on linux because of fsevents
Steps to reproduce:
$ npm ci
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents#2.2.1: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: undefined
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
What I've tried:
Remove the local node_modules & package-lock.json $ rm package-lock.json $ rm -rf node_modules
Update the global npm by $ sudo npm i -g npm
Reinstall the local node_modules by $ npm install
Executing $ npm ci
Also tried $ npm cache --force clean
Also tried $ npm audit fix
Problem:
I can't find out what dependency is causing the issue as everything is working fine on my Mac. But my google cloud linux server seems to have problems with fsevents as it's incompatible. And I can't find out how to fix it or what I should remove. So I'm not able to use my server anymore since this error occurred.
My package.json
{
"name": "app-ant",
"version": "0.1.0",
"private": true,
"dependencies": {
"#dnd-kit/core": "^3.0.3",
"#google-cloud/storage": "^5.8.3",
"#react-pdf/renderer": "^2.0.14",
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"antd": "^4.15.1",
"array-move": "^3.0.1",
"axios": "^0.21.1",
"bizcharts": "^4.1.9",
"core-js": "3.3",
"cross-env": "^7.0.3",
"exif-js": "^2.3.0",
"file-saver": "^2.0.5",
"firebase": "^8.7.1",
"framer-motion": "^4.1.17",
"gantt-schedule-timeline-calendar": "^3.6.6",
"google-map-react": "^2.1.9",
"google-maps-react": "^2.0.6",
"i": "^0.3.6",
"intl-tel-input": "^17.0.12",
"moment-timezone": "^0.5.33",
"npm": "^6.14.12",
"react": "^16.8.0",
"react-beautiful-dnd": "^13.1.0",
"react-color": "^2.19.3",
"react-csv": "^2.0.3",
"react-dom": "^16.14.0",
"react-firebase-hooks": "^3.0.4",
"react-full-screen": "^1.0.2",
"react-geocode": "^0.2.3",
"react-google-autocomplete": "^1.2.6",
"react-google-charts": "^3.0.15",
"react-infinite-scroller": "^1.2.4",
"react-places-autocomplete": "^7.3.0",
"react-quill": "^1.3.5",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"react-shortcuts": "^2.1.0",
"react-simple-maps": "^2.3.0",
"react-sortable-hoc": "^1.11.0",
"react-to-print": "^2.12.4",
"react-tracking": "^8.1.0",
"react-transition-group": "^2.9.0",
"recharts": "^2.0.9",
"typescript": "^4.2.4",
"vcards-js": "^2.10.0",
"vcf": "^2.1.0",
"xmp-js": "0.0.5"
},
"scripts": {
"start": "cross-env HOST=website.com 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": {
"#iconify-icons/bx": "^1.1.0",
"#iconify-icons/el": "^1.1.0",
"#iconify-icons/mdi": "^1.1.14",
"#iconify/react": "^1.1.4"
}
}
npm_dependencies_tree output: npm ls --all
https://drive.google.com/file/d/1-yZ289sT3kOUPtb-KzewwSlGdF22jXZ6/view?usp=sharing
Thank you in advance for your support on my problem.
This is a well-known problem, one of your package dependencies needs fs-events when running on macOS.
When Node.js is running on Linux,this package is not needed, and since you are using --ci flag, it fails to install fs-events on Linux.
You can try removing --ci flag or you can try adding fs-events in optionalDependencies in your package file.
"optionalDependencies": {
"fsevents": "*"
},

npm err! code 1 when performing npm install

I have looked at the other posts concerning other people who had this or similar problems and those fixes don't seem to be working for me. When I run "npm install" I constantly get the line "npm ERR! code 1"
This is preventing me form getting to test my code as I can't install my node modules.
Here is part the output:
npm ERR! code 1
npm ERR! path /Users/myname/Documents/blip/blip-api-billbot/node_modules/mongodb-client-encryption
npm ERR! command failed
npm ERR! command sh -c prebuild-install --tag-prefix node-v || node-gyp rebuild
The package.json file:
{
"name": "blip-api-billbot",
"version": "1.0.0",
"description": "Blip's billbot architecture for creating links to biller accounts.",
"main": "chrome-script.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"linuxRebuild": "docker run --rm -v '$PWD':/var/task lambci/lambda:build-nodejs12.x npm rebuild"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#babel/runtime": "^7.12.13",
"aws-sdk": "^2.824.0",
"axios": "^0.21.0",
"axios-cookiejar-support": "^1.0.1",
"base-64": "^1.0.0",
"bindings": "^1.5.0",
"cheerio": "^1.0.0-rc.5",
"chrome-aws-lambda": "^5.5.0",
"dotenv": "^8.2.0",
"fs-extra": "^9.0.1",
"glob": "^7.1.6",
"lambda-packager": "^0.2.1",
"mongodb": "^3.6.3",
"mongodb-client-encryption": "^1.1.0",
"node-downloader-helper": "^1.0.15",
"node-fetch": "^2.6.1",
"puppeteer": "^2.1.1",
"puppeteer-extra": "^3.1.15",
"puppeteer-extra-plugin-adblocker": "^2.11.9",
"puppeteer-extra-plugin-repl": "^2.2.8",
"puppeteer-extra-plugin-stealth": "^2.6.5",
"qs": "^6.9.4",
"rimraf": "^3.0.2",
"serverless-docker-artifacts": "^0.1.1",
"serverless-dotenv-plugin": "^3.1.0",
"serverless-offline": "^5.12.1",
"serverless-plugin-scripts": "^1.0.2",
"tough-cookie": "^4.0.0",
"uuid": "^8.3.2",
"uuid-mongodb": "^2.4.1"
}
}

NativeBase setup/installation error

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/

node start error in Windows

Windows MEVN stack project
i have npm start terminal output:
$ npm start
> nodejs-starter#1.0.0 start C:\final-dip\diplom-master
> SECRET=diplom nodemon index.js
"SECRET" is not internal or external
command, executable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nodejs-starter#1.0.0 start: `SECRET=diplom nodemon index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejs-starter#1.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\Admin\AppData\Roaming\npm-cache\_logs\2018-05-04T10_33_19_073Z-debug.log
code in package.json:
{
"name": "nodejs-starter",
"version": "1.0.0",
"description": "A boilerplate for NodeJS web servers",
"main": "index.js",
"scripts": {
"start": "SECRET=diplom nodemon index.js",
"init": "node ./controllers/init",
"debug": "cross-env PORT=3333 SECRET=GREEN_BUS nodemon --inspect index.js"
},
"keywords": [],
"author": "Almat Ybray",
"license": "MIT",
"devDependencies": {
"eslint": "^4.14.0",
"nodemon": "^1.14.7"
},
"dependencies": {
"async": "^2.6.0",
"body-parser": "^1.18.2",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"express": "^4.16.2",
"express-jwt": "^5.3.1",
"express-validator": "^5.0.3",
"helmet": "^3.9.0",
"jsonwebtoken": "^8.2.0",
"mongoose": "^5.0.0-rc1",
"morgan": "^1.9.0",
"multer": "^1.3.0",
"passport": "^0.4.0",
"passport-local": "^1.0.0",
"socket.io": "^2.0.4"
}
}
You're missing cross-env for your start script. Change your package.json to:
{
"scripts": {
"start": "cross-env SECRET=diplom nodemon index.js"
}
}
It's already being used in the debug script.
NOTE It's also not part of dependencies so it has to be added via npm i cross-env --save.

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"
}
}

Resources