npm install doesn't install dependencies in Angular project - node.js

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.

Related

how to fix npm ERR! code ELIFECYCLE (heroku)

I'm currently working on a project since i've been teaching myself Angular over the past couple weeks. I wrote up my code, created what I thought I needed for deploying on heroku and tried to deploy it. I received the following error
-----> Build
Detected both "build" and "heroku-postbuild" scripts
Running heroku-postbuild
> purposefularmament#0.0.0 heroku-postbuild /tmp/build_2c8456a0
> ng build --configuration production
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! purposefularmament#0.0.0 heroku-postbuild: `ng build --configuration
production`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the purposefularmament#0.0.0 heroku-postbuild 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! /tmp/npmcache.JjS0Q/_logs/2022-09-23T14_54_55_966Z-debug.log
-----> Build failed
after doing some research I only found that this error is caused by an issue with my npm install. I deleted my node_modules file and removed package-lock.json, cleared the npm cache and then reinstalled npm. I repushed the code and Im still getting this same error.
Any suggestions?
Here is my package.json and server.js files
{
"name": "purposefularmament",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "node server.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"heroku-postbuild": "ng build --configuration production"
},
"private": true,
"dependencies": {
"#angular/animations": "~11.1.2",
"#angular/cli": "^14.2.3",
"#angular/common": "~11.1.2",
"#angular/compiler": "~11.1.2",
"#angular/compiler-cli": "^11.2.14",
"#angular/core": "~11.1.2",
"#angular/forms": "~11.1.2",
"#angular/platform-browser": "~11.1.2",
"#angular/platform-browser-dynamic": "~11.1.2",
"#angular/router": "~11.1.2",
"bootstrap": "^5.2.1",
"bootstrap-icons": "^1.9.1",
"bulma": "^0.9.4",
"express": "^4.18.1",
"grunt-express": "^1.4.1",
"node": "^14.15.0",
"path": "^0.12.7",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"typescript": "~4.1.2",
"zone.js": "~0.11.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.1101.4",
"#angular/cli": "^14.2.3",
"#angular/compiler-cli": "^11.2.14",
"#types/jasmine": "~3.6.0",
"#types/node": "^12.11.1",
"autoprefixer": "^10.4.8",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.2.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"postcss": "^8.4.16",
"protractor": "~7.0.0",
"tailwindcss": "^3.1.8",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.1.2"
},
"engines": {
"node": "14.15.0",
"npm": "6.14.13"
}
}
and server.js
//Install express server
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist/purposefularmament'));
app.get('/*', function(req,res) {
res.sendFile('index.html', {root: 'dist/purposefularmament/'});
});
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);
Welp I spoke too soon, for those of you how care I fixed the issue by updating node.js to the newest latest version. I was lead to believe that both heroku and my local system should use the same node version. For whatever reason my version was behind. After adjusting for the new node version I repushed and everything worked.

Could not resolve peer dependency between my Angular app and my custom Angular library

I have created this Angular library that I now want to use in my other Angular apps, but I seem to have trouble with my peer dependencies. I have tried fiddling around in my App's package.json, but couldn't seem to remove any of my errors.
What I have tried (in that order) :
Removing node_modules
ng update
npm update
npm audit --fix
npm i
Recreating a new test app all together
Here are the errors :
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: lib-test#0.0.0
npm ERR! Found: #angular/common#13.0.3
npm ERR! node_modules/#angular/common
npm ERR! #angular/common#"~13.0.0" from the root project
npm ERR! peer #angular/common#"^13.0.0 || ^14.0.0-0" from #angular/cdk#13.2.2
npm ERR! node_modules/#angular/cdk
npm ERR! #angular/cdk#"^13.2.0" from the root project
npm ERR! peer #angular/cdk#"^13.0.0" from #my-group/angular-lib#1.1.4
npm ERR! node_modules/#my-group/angular-lib
npm ERR! #my-group/angular-lib#"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #angular/common#"^13.1.0" from #my-group/angular-lib#1.1.4
npm ERR! node_modules/#my-group/angular-lib
npm ERR! #my-group/angular-lib#"*" 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.
package.json (App)
{
"name": "lib-test",
"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.0.0",
"#angular/cdk": "^13.2.2",
"#angular/common": "~13.0.0",
"#angular/compiler": "~13.0.0",
"#angular/core": "~13.0.0",
"#angular/forms": "~13.0.0",
"#angular/material": "^13.2.2",
"#angular/platform-browser": "~13.0.0",
"#angular/platform-browser-dynamic": "~13.0.0",
"#angular/router": "~13.0.0",
"#cloud-republic/angular-lib": "^1.1.4",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "~13.0.3",
"#angular/cli": "~13.0.3",
"#angular/compiler-cli": "~13.0.0",
"#types/jasmine": "~3.10.0",
"#types/node": "^12.11.1",
"jasmine-core": "~3.10.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.4.3"
}
}
package.json (Library)
{
"name": "#my-group/angular-lib",
"version": "1.0.6",
"publishConfig": {
"#my-group:registry": "https://gitlab.com/api/v4/projects/XXXXXX/packages/npm/"
},
"scripts": {
"build-lib": "ng build lib-angular",
"semantic-release": "semantic-release"
},
"peerDependencies": {
"#angular/cdk": "^13.0.0",
"#angular/common": "^13.1.0",
"#angular/core": "^13.1.0",
"#angular/material": "^13.2.0",
"ngx-bootstrap": "^8.0.0",
"rxjs": "~7.4.0"
},
"dependencies": {
"tslib": "^2.3.0"
},
"devDependencies": {
"#semantic-release/gitlab": "^7.0.4",
"semantic-release": "^19.0.2"
}
}
Thanks in advance
This is not the issue with peer dependencies. This is more to do with version conflict. I guess you are using npm >=7 that's why you are getting this error:-
As mentioned in the error log try the below command to fix the issue:-
npm install --legacy-peer-deps
The above solution will solve your problem. However, the main issue is with your library.
In your library package you are saying use the below package:-
"#angular/common": "^13.1.0"
However, in your application, you have installed the below version.
"#angular/common": "~13.0.0".
So your library package is greater than the one installed in the application.
Either install the same version in your application or downgrade the version in your library.
In this way, npm install command will work without any issue.

Same exact package.json file works in empty brand new project but doesn't in old project

I get this error when I try to upgrade to Angular 8.
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an
old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from
the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: comprehensivedashboard#0.0.0
npm ERR! Found: #angular/animations#7.2.6
npm ERR! node_modules/#angular/animations
npm ERR! #angular/animations#"~8.2.14" from the root project
npm ERR! peer #angular/animations#">=7.0.0" from
#angular/material#7.3.3
npm ERR! node_modules/#angular/material
npm ERR! #angular/material#"~8.2.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! #angular/animations#"~8.2.14" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #angular/core#8.2.14
npm ERR! node_modules/#angular/core
npm ERR! peer #angular/core#"8.2.14" from #angular/animations#8.2.14
npm ERR! node_modules/#angular/animations
npm ERR! #angular/animations#"~8.2.14" 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\vakkinen\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\vakkinen\AppData\Local\npm-cache_logs\2021-10-05T12_19_50_257Z-debug.log
So decided to create a brand new Angular8 app and see what the package.json file looks like. That file is attached below. Then I added all the packages I need to this brand new empty project one at a time. The application build succeeded and I was able to run the application. So I copied and pasted all the dependencies and devDependencies to the old project package.json. That project still fails npm i because of the same error above. So I tried to clone the repo into a new directory and replaced the contents of the package.json with the contents of the package.json from the brand new empty project, still the same error. What am I doing wrong ?
{
"name": "dashboard",
"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": "~8.2.14",
"#angular/cdk": "8.2.3",
"#angular/common": "~8.2.14",
"#angular/compiler": "~8.2.14",
"#angular/core": "~8.2.14",
"#angular/forms": "~8.2.14",
"#angular/material": "~8.2.3",
"#angular/platform-browser": "~8.2.14",
"#angular/platform-browser-dynamic": "~8.2.14",
"#angular/router": "~8.2.14",
"#ng-bootstrap/ng-bootstrap": "^5.3.0",
"bootstrap": "^4.3.1",
"core-js": "^2.5.4",
"#swimlane/ngx-charts": "^11.0.0",
"fusioncharts": "^3.15.0-sr.1",
"hammerjs": "^2.0.8",
"moment": "^2.24.0",
"ngx-bootstrap": "^3.2.0",
"ngx-csv": "^0.3.1",
"ngx-export-as": "1.4.2",
"ngx-scrollbar": "^4.1.1",
"ngx-select-dropdown": "^1.0.1",
"node-sass": "^4.14.0",
"rxjs": "~6.4.0",
"sass-loader": "^8.0.2",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.13.0",
"#angular/cli": "~8.3.29",
"#angular/compiler-cli": "~8.2.14",
"#angular/language-service": "~8.2.14",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"protractor": "~7.0.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
There should be a file called package-lock in the same folder as the package file. Delete it and the error should go away. The package-lock file contains all dependencies of your dependencies and their versions. Deleting it doesn’t affect your project since it’s regenerated on npm install.
The error message warns you that the package-lock.json file is the issue. Just delete it and a new one will be generated.
The issue stems from having incorrect files in the node_modules directory and the package-lock.json.
Most probably the easiest solution is to delete both the node_modules directory and the package-lock.json and then running a npm install to get a clean node_modules directory and a new package-lock.json according to your package.json
I recommend reading more about what the package-lock.json file is for here: https://medium.com/coinmonks/everything-you-wanted-to-know-about-package-lock-json-b81911aa8ab8
Steps to fix this issue:
Delete node_modules folder.
Delete package-lock.json.
Run npm i --force.

Error while trying to run 'npm start'

I am getting the below error while trying to run npm start without updating the node version nor the npm version.
ERROR
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Work\node-v6.10.3-win-x64\node-v6.10.3-win-x64\node.exe" "
C:\Work\node-v6.10.3-win-x64\node-v6.10.3-win-x64\node_modules\npm\bin\np
m-cli.js" "start"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! ucps-online-client#1.0.0 start: ng serve --proxy-config proxy.conf.jso
n
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ucps-online-client#1.0.0 start script 'ng serve --proxy-c
onfig proxy.conf.json'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ucps-online-client pa
ckage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng serve --proxy-config proxy.conf.json
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ucps-online-client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ucps-online-client
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Work\workspace_Nov9_commit\ucps-online-parent\ucps-online-client
\npm-debug.log
Package.json
{
"name": "ucps-online-client",
"version": "1.0.0",
"private": true,
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"lint": "ng lint"
},
"dependencies": {
"#angular/animations": "^4.0.1",
"#angular/common": "^4.0.0",
"#angular/compiler": "^4.0.0",
"#angular/core": "^4.0.0",
"#angular/forms": "^4.0.0",
"#angular/http": "^4.0.0",
"#angular/platform-browser": "^4.0.0",
"#angular/platform-browser-dynamic": "^4.0.0",
"#angular/router": "^4.0.0",
"bootstrap": "3.3.7",
"core-js": "^2.4.1",
"font-awesome": "4.6.3",
"jquery": "2.2.3",
"latest-version": "^3.1.0",
"moment": "2.17.1",
"ng2-bootstrap": "1.6.3",
"ng2-datepicker": "^1.8.3",
"ng2-datetime-picker": "^0.12.5",
"ng2-pagination": "^2.0.2",
"primeng": "4.1.0",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.8.5"
},
"devDependencies": {
"#angular/compiler-cli": "^4.0.0",
"#types/node": "^7.0.12",
"#angular/cli": "^1.0.0",
"codelyzer": "^2.1.1",
"ts-node": "^3.0.2",
"tslint": "^5.0.0",
"typescript": "^2.2.2"
},
"engines": {
"node": ">= 6.9.1",
"npm": ">= 3"
}
}

Package is not working angular 2

I am new to angular2 and I have problem with angular 2 package. I have been trying to fix the problem and I couldn't. I am doing some assignment/project and the teacher provide with package.json with assignment. I install npm in locally on project folder as well as globally, but I couldn't start local server. I am running the program at window. The problem is here, when I run npm start or npm start -server I got the following error:
npm ERR! node v6.9.2
npm ERR! npm v2.12.1
npm ERR! code ELIFECYCLE
npm ERR! angular2-boilerplate#1.0.0 start: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular2-boilerplate#1.0.0 start script 'gulp'.
npm ERR! This is most likely a problem with the angular2-boilerplate package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp
npm ERR! You can get their info via:
npm ERR! npm owner ls angular2-boilerplate
npm ERR! There is likely additional logging output above.
package.json file is
{
"name": "angular2-boilerplate",
"version": "1.0.0",
"scripts": {
"start": "gulp",
"gulp": "gulp",
"watch": "gulp watch",
"clean": "gulp clean",
"typings": "typings",
"postinstall": "typings install"
},
"license": "MIT",
"dependencies": {
"#angular/common": "2.0.0-rc.1",
"#angular/compiler": "2.0.0-rc.1",
"#angular/core": "2.0.0-rc.1",
"#angular/http": "2.0.0-rc.1",
"#angular/platform-browser": "2.0.0-rc.1",
"#angular/platform-browser-dynamic": "2.0.0-rc.1",
"#angular/router": "2.0.0-rc.1",
"#angular/router-deprecated": "2.0.0-rc.1",
"#angular/upgrade": "2.0.0-rc.1",
"systemjs": "0.19.27",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12"
},
"devDependencies": {
"babel-core": "^6.0.15",
"babel-preset-es2015": "^6.0.15",
"browser-sync": "^2.10.1",
"del": "^2.0.0",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.1.0",
"gulp-concat": "^2.6.0",
"gulp-concat-css": "^2.2.0",
"gulp-inline-ng2-template": "^1.1.2",
"gulp-minify-css": "^1.2.1",
"gulp-typescript": "^2.10.0",
"gulp-watch": "^4.3.5",
"stream-series": "^0.1.1",
"typescript": "^1.7.3",
"typings":"^0.6.8",
"systemjs-builder": "^0.15.15"
}
}

Resources