NPM peer Dependencies - node.js

I'm at the moment upgrading from Angular 4 to Angular 5 and received some warnings after that, for example:
npm WARN #angular/compiler-cli#5.0.1 requires a peer of typescript#>=2.4.2 <2.5 but none is installed. You must install peer dependencies yourself.
npm WARN #covalent/core#1.0.0-beta.8-1 requires a peer of #angular/common#^4.4.3 but none is installed. You must install peer dependencies yourself.
npm WARN #covalent/core#1.0.0-beta.8-1 requires a peer of #angular/core#^4.4.3 but none is installed. You must install peer dependencies yourself.
npm WARN #covalent/core#1.0.0-beta.8-1 requires a peer of #angular/forms#^4.4.3 but none is installed. You must install peer dependencies yourself.
npm WARN #covalent/core#1.0.0-beta.8-1 requires a peer of #angular/http#^4.4.3 but none is installed. You must install peer dependencies yourself.
npm WARN #covalent/core#1.0.0-beta.8-1 requires a peer of #angular/router#^4.4.3 but none is installed. You must install peer dependencies yourself.
npm WARN #covalent/core#1.0.0-beta.8-1 requires a peer of #angular/cdk#^2.0.0-beta.12 but none is installed. You must install peer dependencies yourself.
npm WARN #covalent/core#1.0.0-beta.8-1 requires a peer of #angular/material#^2.0.0-beta.12 but none is installed. You must install peer dependencies yourself.
This is my package.json
{
"name": "myAngularProject",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.0.0",
"#angular/cdk": "^5.0.0-rc0",
"#angular/common": "^5.0.0",
"#angular/compiler": "^5.0.0",
"#angular/core": "^5.0.0",
"#angular/forms": "^5.0.0",
"#angular/http": "^5.0.0",
"#angular/material": "^5.0.0-rc0",
"#angular/platform-browser": "^5.0.0",
"#angular/platform-browser-dynamic": "^5.0.0",
"#angular/router": "^5.0.0",
"#covalent/core": "^1.0.0-beta.8-1",
"#ng-dynamic-forms/core": "^1.4.34",
"#ng-dynamic-forms/ui-material": "^1.4.34",
"ag-grid": "^13.3.1",
"ag-grid-angular": "^13.3.0",
"angular-in-memory-web-api": "^0.3.2",
"core-js": "^2.5.1",
"ng2-dnd": "^4.2.0",
"rxjs": "^5.5.2",
"webpack": "^3.8.1",
"zone.js": "^0.8.18"
},
"devDependencies": {
"#angular/cli": "^1.5.0",
"#angular/compiler-cli": "^5.0.0",
"#types/jasmine": "2.5.38",
"#types/node": "^6.0.90",
"codelyzer": "~2.0.0",
"install-peers": "^1.0.2",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "^2.3.4"
},
}
My question is now, how do I add those peer dependencies manually and where? I've searched for ways to add them automatically but they do not work.

NOTE:
You don't have to add any peer dependencies, yourself. The message is only displaying that you have unmet dependencies, and I believe you can continue using #covalent package unless something breaks as these are warnings.
This seems to be an issue with the package #covalent as it depends upon #angular4 and it's respective packages and appears to be incompatible . Since there are few breaking changes from angular4 and angular5. So this is an expected behavior.
You have two options now precisely:
Submit PR to the said repository, so you can get a fix asap.
Wait for #covalent to release an update for #angular5, and once the update is out, you can safely update both #angular4 itself and #covalent as well.

Related

peer dependencies in npm

I got error regarding peer dependencies when I try to install package.json using "npm install".
Peer Dependency error
I have learned that I can use "npm install -legacy-peer-deps" from this link What does npm install --legacy-peer-deps do exactly? When is it recommended / What's a potential use case?.
But I know that "npm install --legacy-peer-deps" ignores peer dependencies so I am looking for different solutions for this error that I attached screenshot. I have tried to define "peerDependencies" in package.json to prevent dependency error but the different versions of the same package are shown as a dependency as shown below screenshot.
different versions of peer dependency
My package.json are shown as below. Would you help me about this problem? What do you suggest for peer dependency problems? When I want to add new packages to package.json, I will face the peer dependency problem again. Thanks.
{
"name": "metric-tutorial",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"#angular/animations": "~13.3.0",
"#angular/cdk": "^13.3.9",
"#angular/common": "~13.3.0",
"#angular/compiler": "~13.3.0",
"#angular/core": "~13.3.0",
"#angular/forms": "~13.3.0",
"#angular/material": "^13.3.9",
"#angular/platform-browser": "~13.3.0",
"#angular/platform-browser-dynamic": "~13.3.0",
"#angular/router": "~13.3.0",
"angular-material-fileupload": "^3.0.2",
"mathjax-angular": "^1.4.2",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "~13.3.1",
"#angular/cli": "~13.3.1",
"#angular/compiler-cli": "~13.3.0",
"#types/jasmine": "~3.10.0",
"#types/node": "^12.11.1",
"angular-cli-ghpages": "^1.0.0",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.6.2"
}
}

npm install doesn't install dependencies in Angular project

I have an Angular project. When I run npm install I see some errors and dependencies don't appear in node_modules folder. However, I think none of the errors explain the problem. I see some deprecation warnings and 404 for one dependency, but nothing more.
Here is my package.json:
{
"name": "my-project",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "~9.0.0",
"#angular/cdk": "^9.1.0",
"#angular/common": "~9.0.0",
"#angular/compiler": "~9.0.0",
"#angular/core": "~9.0.0",
"#angular/forms": "~9.0.0",
"#angular/material": "^9.1.0",
"#angular/platform-browser": "~9.0.0",
"#angular/platform-browser-dynamic": "~9.0.0",
"#angular/router": "~9.0.0",
"#css-pkg/circular-std": "^2.0.0",
"#fortawesome/fontawesome-free": "^5.12.1",
"#syncfusion/ej2-angular-calendars": "^18.1.44",
"#types/jquery": "^3.3.38",
"alertifyjs": "^1.13.1",
"angular-mat-datepicker": "0.0.2",
"angular-material": "^1.1.21",
"angularx-qrcode": "^2.1.1",
"bootstrap": "^4.4.1",
"jquery": "^3.4.1",
"material-steppers": "^2.0.0",
"popper.js": "^1.16.1",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.900.4",
"#angular/cli": "~9.0.1",
"#angular/compiler-cli": "~9.0.0",
"#angular/language-service": "~9.0.0",
"#types/jasmine": "~3.5.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~5.18.0",
"typescript": "~3.7.5"
}
}
And here is the log output:
npm WARN deprecated popper.js#1.16.1: You can find the new Popper v2 at #popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#css-pkg%2fcircular-std - Not found
npm ERR! 404
npm ERR! 404 '#css-pkg/circular-std#^2.0.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'traveler-frontend'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mac/.npm/_logs/2020-06-16T20_33_51_531Z-debug.log
Remove "#css-pkg/circular-std": "^2.0.0", line. Because it's not found in the npm package registry. Try npm install again.
The error says #css-pkg/circular-std can't be found. That package may be removed from npm directory. While searching the package I couldn't find it in the directory.

Angular-cli project cross platform build issue

I've created experimental angular-cli project on Mac. Than I've moved it onto ubuntu and cant build:
$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
& start one:
$ ng serve
Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
at Class.run (/project-path/node_modules/#angular/cli/tasks/serve.js:51:63)
at check_port_1.checkPort.then.port (/project-path/node_modules/#angular/cli/commands/serve.js:123:26)
at process._tickCallback (internal/process/next_tick.js:103:7)
I confused, because it worked perfectly on Mac.
Env details
$ npm -v
4.0.5
$ node -v
v7.4.0
$ ng -v
Angular CLI: 1.5.5
Node: 7.4.0
OS: linux x64
Angular: 5.0.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
#angular/cdk: 5.0.0-rc0
#angular/cli: 1.5.5
#angular/material: 5.0.0-rc0
#angular-devkit/build-optimizer: 0.0.34
#angular-devkit/core: 0.0.22
#angular-devkit/schematics: 0.0.39
#ngtools/json-schema: 1.1.0
#ngtools/webpack: 1.8.5
#schematics/angular: 0.1.9
typescript: 2.4.2
webpack: 3.8.1
I've found also answer npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.14 it partly describes the messages, but it doesn't help me with my project running. (It can't be started any way).
To make my project runnable on Ubuntu I need a missed file on Mac (it seems mac does not need one) - .angular-cli.json:
{
"name": "angular4-in60-minutes",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.0.1",
"#angular/cdk": "^5.0.0-rc0",
"#angular/common": "^5.0.0",
"#angular/compiler": "^5.0.0",
"#angular/core": "^5.0.0",
"#angular/forms": "^5.0.0",
"#angular/http": "^5.0.0",
"#angular/material": "^5.0.0-rc0",
"#angular/platform-browser": "^5.0.0",
"#angular/platform-browser-dynamic": "^5.0.0",
"#angular/router": "^5.0.0",
"bootstrap": "^3.2.1",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"jquery": "^3.2.1",
"popper.js": "^1.12.9",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "^1.5.0",
"#angular/compiler-cli": "^5.0.0",
"#angular/language-service": "^5.0.0",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}
After adding this file my project can be started correctly. But issue with warnings present anyway
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

NPM peer dependencies - options for resolution?

First-off, I am new to NodeJs and NPM so thanks in advance for any clarification that anyone can offer me.
This is a question about peer dependencies and warnings given by NPM during package installs. The NPM docs and other questions on StackOverflow don't seem to answer my exact questions about what I can/should do to resolved these dependency issues.
Actually, Everything I have tried seems to have made things worse I am now completely confused.
Starting from a fresh install of the latest Angular CLI I created a new Angular 5 project. To this I have added Angular Material.
When I added Angular flex-layout I got the following warnings:
npm WARN #angular/flex-layout#2.0.0-beta.10-4905443 requires a peer of #angular/core#~4.4.4 but none is installed. You must install peer dependencies yourself.
npm WARN #angular/flex-layout#2.0.0-beta.10-4905443 requires a peer of #angular/common#~4.4.4 but none is installed. You must install peer dependencies yourself.
Adding angular-split adds the following:
npm WARN angular-split#0.2.7 requires a peer of #angular/common#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-split#0.2.7 requires a peer of #angular/core#^4.0.0 but none is installed. You must install peer dependencies yourself.
I have done some successful experiments with angular-layout but angular-split does not seem to be working correctly. The examples on the author's website are fine so I suspect that this might be because it doesn't have the Angular version it is expecting.
Do these warnings imply that I can install the required versions of Angular components side-by-side with the primary versions used by my code to satisfy these libraries' requirements?
Alternatively, do they really mean that flex-layout and angular-split are not fully compatible with the version of Angular that I am using (and therefore I can't use them until they are updated).
In summary, can different versions of the same module co-exist in a project, and if so, what steps do I need to take because all I have done so far is get myself in a dreadful mess.
This is what my packages.json file looks like:
{
"name": "angular-test4",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.0.0",
"#angular/cdk": "^5.0.0-rc.2",
"#angular/common": "^5.0.0",
"#angular/compiler": "^5.0.0",
"#angular/core": "^5.0.3",
"#angular/flex-layout": "^2.0.0-beta.10-4905443",
"#angular/forms": "^5.0.0",
"#angular/http": "^5.0.0",
"#angular/material": "^5.0.0-rc.2",
"#angular/platform-browser": "^5.0.0",
"#angular/platform-browser-dynamic": "^5.0.0",
"#angular/router": "^5.0.0",
"angular-split": "^0.2.7",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "1.5.4",
"#angular/compiler-cli": "^5.0.0",
"#angular/language-service": "^5.0.0",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}

Ionic 2 : Warn after "npm install"

I use Ionic v2.1.8 and when I run the command "npm install" I have a lot of warn like this :
C:\xampp\htdocs\AppFineMobile>npm install
npm WARN #angular/compiler#2.4.8 requires a peer of #angular/core#2.4.8 but none was installed.
npm WARN #angular/compiler-cli#2.4.8 requires a peer of #angular/core#2.4.8 but none was installed.
npm WARN #angular/forms#2.4.8 requires a peer of #angular/core#2.4.8 but none was installed.
npm WARN #angular/forms#2.4.8 requires a peer of #angular/common#2.4.8 but none was installed.
npm WARN #angular/http#2.4.8 requires a peer of #angular/core#2.4.8 but none was installed.
npm WARN #angular/http#2.4.8 requires a peer of #angular/platform-browser#2.4.8 but none was installed.
npm WARN #angular/platform-browser-dynamic#2.4.8 requires a peer of #angular/core#2.4.8 but none was installed.
npm WARN #angular/platform-browser-dynamic#2.4.8 requires a peer of #angular/common#2.4.8 but none was installed.
npm WARN #angular/platform-browser-dynamic#2.4.8 requires a peer of #angular/platform-browser#2.4.8 but none was installed.
npm WARN #angular/platform-server#2.4.8 requires a peer of #angular/core#2.4.8 but none was installed.
npm WARN #angular/platform-server#2.4.8 requires a peer of #angular/common#2.4.8 but none was installed.
npm WARN #angular/platform-server#2.4.8 requires a peer of #angular/platform-browser#2.4.8 but none was installed.
npm WARN ionic-angular#2.2.0 requires a peer of #angular/common#2.4.8 but none was installed.
npm WARN ionic-angular#2.2.0 requires a peer of #angular/core#2.4.8 but none was installed.
npm WARN ionic-angular#2.2.0 requires a peer of #angular/platform-browser#2.4.8 but none was installed.
npm WARN ionic-angular#2.2.0 requires a peer of rxjs#5.0.1 but none was installed.
npm WARN ionic-angular#2.2.0 requires a peer of zone.js#0.7.2 but none was installed.
My package.json file :
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"test": "ng test"
},
"config": {
"ionic_copy": "./config/copy.config.js"
},
"dependencies": {
"#angular/common": "^2.4.0",
"#angular/compiler": "^2.4.0",
"#angular/compiler-cli": "^2.4.0",
"#angular/core": "^2.4.0",
"#angular/forms": "^2.4.0",
"#angular/http": "^2.4.0",
"#angular/platform-browser": "^2.4.0",
"#angular/platform-browser-dynamic": "^2.4.0",
"#angular/platform-server": "^2.4.0",
"#angular/router": "^3.4.0",
"#ionic/storage": "2.0.0",
"font-awesome": "^4.7.0",
"ionic-angular": "2.2.0",
"ionic-native": "2.4.1",
"ionicons": "3.0.0",
"rxjs": "^5.1.0",
"sw-toolbox": "3.4.0",
"zone.js": "^0.7.6"
},
"devDependencies": {
"#angular/cli": "^1.0.0",
"#ionic/app-scripts": "1.1.4",
"codecov": "^2.1.0",
"jasmine-core": "^2.5.2",
"karma": "^1.5.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.1.0",
"karma-mocha-reporter": "^2.2.3",
"karma-remap-istanbul": "^0.6.0",
"typescript": "2.0.9"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"ionic-plugin-keyboard",
"cordova-plugin-splashscreen"
],
"cordovaPlatforms": [],
"description": "AppFineMobile: An Ionic project"
}
I don't understand because I have these modules on my node_modules folder. And when I tried to install one of them, I keep the warn with another npm install.
I really don't understand and I don't know how to solve that
You just need to update all your angular packages to 2.4.8.Also your ionic-angular package is 2.2.0.
Change:
"#angular/common": "^2.4.8",
"#angular/compiler": "^2.4.8",
"#angular/compiler-cli": "^2.4.8",
"#angular/core": "^2.4.8",
"#angular/forms": "^2.4.8",
"#angular/http": "^2.4.8",
"#angular/platform-browser": "^2.4.8",
"#angular/platform-browser-dynamic": "^2.4.8",
"#angular/platform-server": "^2.4.8",
Also
"rxjs": "^5.0.1",
"zone.js" :"0.7.2"
Clear your node_modules folder in case of issues and do:
npm install

Resources