How to solve npm "UNMET PEER DEPENDENCY" - node.js

I am having issues with my package.json file.
It should work fine as as I use most of the node modules in other projects, but I have this package.json below:
"dependencies": {
"#angular/common": "^2.0.0-rc.1",
"#angular/compiler": "^2.0.0-rc.1",
"#angular/core": "^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",
"angular2-in-memory-web-api": "0.0.7",
"bootstrap": "^3.3.6",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.0.0-beta.6",
"systemjs": "^0.19.27",
"zone.js": "^0.6.12"
},
"devDependencies": {
"body-parser": "^1.15.1",
"express": "^4.13.4",
"jsonwebtoken": "^6.2.0",
"mongoose": "^4.4.15"
}
and they should all run fine as all dependencies exist as angular is now in rc.4 and rxjs is on 5.0.0-beta.10.
But I get 3 unmet dependencies on
npm install
'rxjs#5.0.0-beta.10'
'rxjs#5.0.0-beta.6'
'#angular/core#2.0.0-rc.1'
I get these warnings too:
npm WARN #angular/core#2.0.0-rc.4 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
npm WARN #angular/http#2.0.0-rc.1 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
npm WARN #angular/http#2.0.0-rc.1 requires a peer of #angular/core#2.0.0-rc.1 but none was installed.
I have also done:
npm cache clean
npm update registry > with the registry link
npm update -g
node is on latest version and still same issue... so just wondering if there is something wrong?

I think its because the dependency resolution is a bit broken, see https://github.com/isaacs/npm/issues/1341#issuecomment-20634338
You may need to manually install top-level modules that have unmet dependencies:
npm install findup-sync#0.1.2
Or structure your package.json such that any top-level modules that are also dependencies of other modules are listed lower down.
Your problem could also be that npm failed to download the package, timed-out or whatnot. Sometimes re-running npm install remedies it.
You can also install the failed packages manually as well using npm install
Other steps that may help before attempting npm install again are:
Removing node_modules using:
rm -rf node_modules/
then
npm cache clean
To explain why removing node_modules sometimes is necessary:
Apparently if a nested module fails to install during npm install, subsequent npm install won't detect those missing nested dependencies. If that's the case, sometimes it's sufficient to remove the top-level dependency of those missing nested modules, and running npm install again.
See https://github.com/npm/npm/issues/1336

Related

Fixing NPM vulnerabilities

I am following a TypeScript tutorial. Unfortunately, the packages are outdated and I got a warning about vulnerabilities.
I followed a bunch of suggestions from npm check and update package if needed, namely:
npm audit fix
npm audit fix --force
npm update
npm audit says there are still 24 vulnerabilities left. But none of the above commands will fix them.
npm outdated results in no output.
The vulnerable packages are:
ansi-regex
glob-parent
node-forge
nth-check
postcss
I don't actually know why they are part of my project, I don't have them in my package.json configuration.
What are the next steps of fixing these vulnerabilities?
I have tried:
How to fix npm vulnerabilities?
which has no answers.
updating the dependencies in package.json manually to newer versions and then running npm install. It didn't have an effect.
deleting package-lock.json according to a suggestion here and then run npm install again.
adding "ansi-regex": "^6.0.1", "glob-parent": "^6.0.2", "node-forge": "^1.3.0", "nth-check": "^2.0.1", "postcss": "^8.4.12" as as devDependencies and running npm install.
running npm i npm#latest as suggested in How to fix NPM vulnerabilities
How to fix npm vulnerabilities? I tried two methods, problems persist which didn't have any new suggestions
I have 5 moderate severity vulnerabilities when I checked the npm audit. How can I fix these errors given below? which also didn't suggest any new commands
running npm update glob-parent --depth 2 just to find out that --depth is deprecated and NPM always updates any depth [Github]
running npm prune
deleting the node_modules folder and running npm install again
You can reproduce my latest state with the following package.json in an empty directory and running npm install.
{
"name": "pacman",
"version": "0.0.1",
"description": "I just follow a tutorial. Nothing of interest.",
"keywords": ["game"],
"license": "MIT",
"author": "someone stupid",
"scripts": {
"build": "parcel build index.html",
"dev": "parcel index.html --open",
"start": "npm run build && npm run dev",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"#typescript-eslint/eslint-plugin": "^5.16.0",
"#typescript-eslint/parser": "^5.16.0",
"ansi-regex": "^6.0.1",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"glob-parent": "^6.0.2",
"node-forge": "^1.3.0",
"nth-check": "^2.0.1",
"parcel": "^2.4.0",
"parcel-bundler": "^1.12.5",
"postcss": "^8.4.12",
"prettier": "^2.6.1",
"typescript": "^4.6.3"
},
"dependencies": {
"npm": "^8.5.5"
}
}
This should give you 24 vulnerabilities, 18 moderate and 6 high (at the time of writing, running npm 8.5.5).
As per the comments, I have already tried all commands for the general case, in which case you need to start analyzing individual packages.
So, what did I do?
Update all dependencies to the latest version.
Next, perform a binary search by removing half of the dependencies and repeating the following steps
delete the node_modules folder
run npm install
run npm audit to check for the vulnerabilities
If there are no vulnerabilites, add the half of the remaining packages you want to install.
If there are vulnerabilities, remove the half of the packages you are currently installing.
In my case, this process boiled it down to the following two lines:
"parcel": "^2.4.0",
"parcel-bundler": "^1.12.5",
For parcel-bundler, NPM spit out a warning:
npm WARN deprecated parcel-bundler#1.12.5: Parcel v1 is no longer maintained.
Please migrate to v2, which is published under the 'parcel' package.
So I guess I don't need parcel-bundler at all, because it has been integrated into the parcel package, which I had already updated to version 2 in an earlier step.
Try to update all your npm with this command. It helped me
npm install -g npm#latest

npm install for angular 7 app errors with: Could not find module "#angular-devkit/build-ng-packagr" from .../.npm/_cacache/tmp

I'm no expert with JavaScript, node, npm, Angular, etc. I am a newbie with TypeScript. But I have inherited a application and I need to maintain it to fix a cross-site cookie problem.
So, I'm trying to get the development environment set up. I am stuck at npm install with a complaint of not finding a module #angular-devkit/build-ng-packagr. The same error happens when I try to explicitly install that module. Here is the log (with lots of similar lines omitted):
$ npm install #angular-devkit/build-ng-packagr
ngx-charts#0.0.0 prepack /home/kbuchs/.npm/_cacache/tmp/git-clone-a312e0b2
npm run package
ngx-charts#0.0.0 package /home/kbuchs/.npm/_cacache/tmp/git-clone-a312e0b2
npm run build:lib
ngx-charts#0.0.0 build:lib /home/kbuchs/.npm/_cacache/tmp/git-clone-a312e0b2
ng build #swimlane/ngx-charts && npm run copy-files
Could not find module "#angular-devkit/build-ng-packagr" from "/home/kbuchs/.npm/_cacache/tmp/git-clone-a312e0b2".
Error: Could not find module "#angular-devkit/build-ng-packagr" from "/home/kbuchs/.npm/_cacache/tmp/git-clone-a312e0b2".
at Object.resolve (/usr/lib/node_modules/#angular/cli/node_modules/#angular-devkit/core/node/resolve.js:141:11)
at Observable.rxjs_1.Observable [as _subscribe] (/usr/lib/node_modules/#angular/cli/node_modules/#angular-devkit/architect/src/architect.js:132:40)
at Observable._trySubscribe (/usr/lib/node_modules/#angular/cli/node_modules/rxjs/internal/Observable.js:44:25)
at Observable.subscribe (/usr/lib/node_modules/#angular/cli/node_modules/rxjs/internal/Observable.js:30:22)
at /usr/lib/node_modules/#angular/cli/node_modules/rxjs/internal/Observable.js:99:19
at new Promise (<anonymous>)
at Observable.toPromise (/usr/lib/node_modules/#angular/cli/node_modules/rxjs/internal/Observable.js:97:16)
at BuildCommand.initialize (/usr/lib/node_modules/#angular/cli/models/architect-command.js:88:94)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ngx-charts#0.0.0 build:lib: `ng build #swimlane/ngx-charts && npm run copy-files`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ngx-charts#0.0.0 build:lib script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /home/kbuchs/.npm/_logs/2020-02-25T17_01_41_575Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ngx-charts#0.0.0 package: `npm run build:lib`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ngx-charts#0.0.0 package script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /home/kbuchs/.npm/_logs/2020-02-25T17_01_41_608Z-debug.log
npm WARN tar ENOENT: no such file or directory, open '/home/kbuchs/git/host-analytics/node_modules/.staging/got-f7f3ba2c/package.json'
npm WARN tar ENOENT: no such file or directory, open '/home/kbuchs/git/host-analytics/node_modules/.staging/got-f7f3ba2c/index.js'
. . .
npm WARN #angular-devkit/build-ng-packagr#0.11.4 requires a peer of ng-packagr#^2.2.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! premature close
npm ERR! A complete log of this run can be found in:
npm ERR! /home/kbuchs/.npm/_logs/2020-02-25T15_51_50_301Z-debug.log
Somehow the build of ngx-charts is coming out of the package.json. Package.json has some scripts defined, but I don't know what would cause npm to want to start building when I just asked it to install.
Nothing ever gets installed in node_modules, by the way, for the above actions or any of what I describe below.
I'll insert my package.json at the bottom.
I have tried cleaning up to start from scratch. I removed the node_modules directory. Also removed ~/.npm/*. I tried all this using node version 13.
If I rename the package.json and package-lock.json files, I can install individual modules without a problem. With those files with their original names, I do note that trying to explicitly install a particular module, npm seems to run through building a full dependency tree for the contents of those files.
So, next, I tried to go back to the version of node that was current when the project was first created about 16 months ago, node 10.19.0. I installed the n module globally to do this (sudo npm install -g n). This changed the version of npm to 6.13.4. Still the same results were encountered.
I noticed the warning near the end about peer dependency of ng-packagr#^4.0.0 and tried to install that (npm install ng-packagr#^4.0.0). I got all the same errors but a different warning about a peer dependency on tsickle#>=0.34.0. Again,I tried npm install tsickle#>=0.34.0 and got all the same errors and more with a warning on a peer dependency on typescript#~3.7.2. So, I did sudo npm install -g typescript#~3.7.2 which worked fine with no errors or warnings. When I went back to try to install tsickle, again the errors came and the message about the peer dependency on typescript. It feels like I'm chasing my tail.
Can anyone suggest a way out?
My package.json:
{
"name": "analytics",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build.dev": "ng build -c dev",
"build.staging": "ng build -c staging",
"build.master": "ng build -c prod",
"deploy.dev": "cp app.dev.yaml dist/app.yaml && gcloud app deploy dist/app.yaml",
"deploy.staging": "cp app.staging.yaml dist/app.yaml && gcloud beta app deploy dist/app.yaml",
"deploy.master": "cp app.prod.yaml dist/app.yaml && gcloud beta app deploy dist/app.yaml",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular-devkit/build-ng-packagr": "~0.11.1",
"#angular/animations": "~7.1.0",
"#angular/common": "~7.1.0",
"#angular/compiler": "~7.1.0",
"#angular/core": "~7.1.0",
"#angular/forms": "~7.1.0",
"#angular/platform-browser": "~7.1.0",
"#angular/platform-browser-dynamic": "~7.1.0",
"#angular/router": "~7.1.0",
"#ng-bootstrap/ng-bootstrap": "^4.0.0",
"#priotas/angular-bootstrap-slider": "^1.1.26",
"#swimlane/ngx-charts": "github:swimlane/ngx-charts#master",
"#types/date-fns": "^2.6.0",
"auth0-js": "^9.8.2",
"bootstrap": "^4.0.0-beta.3",
"bootstrap-slider": "^10.3.4",
"compact-timezone-list": "^1.0.6",
"core-js": "^2.5.4",
"d3": "^5.7.0",
"date-fns": "^1.30.1",
"font-awesome": "^4.7.0",
"html2canvas": "^1.0.0-alpha.12",
"html2pdf": "0.0.11",
"jspdf": "^1.5.3",
"lodash": "^4.17.11",
"moment": "^2.22.2",
"moment-timezone": "^0.5.23",
"ng-multiselect-dropdown": "^0.2.3",
"ng2-timezone-selector": "^0.2.4",
"ngx-webstorage-service": "^3.1.1",
"print-js": "^1.0.54",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.11.0",
"#angular/cli": "~7.1.1",
"#angular/compiler-cli": "~7.1.0",
"#angular/language-service": "~7.1.0",
"#types/jasmine": "~2.8.8",
"#types/jasminewd2": "~2.0.3",
"#types/lodash": "^4.14.120",
"#types/node": "^8.10.45",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"ncp": "^2.0.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.1.6"
}
}
Since this is an Angular 7 app, that points to it being older code, which makes me suspect that this is probably not a valid dependency:
"#swimlane/ngx-charts": "github:swimlane/ngx-charts#master",
since that's going to pull the current version of ngx-charts from github. Looking at releases, Angular 7.1.0 was released in Nov. 2018 (ref: https://github.com/angular/angular-cli/releases/tag/v.7.1.0); so I'd try using a version of ngx-charts that was contemporary to that (it looks like 10.0.0 or 10.1.0 would be good bets, per https://github.com/swimlane/ngx-charts/releases).
So ... to be safe:
rm -r package-lock.json node_modules
npm i --save #swimlane/ngx-charts#10.1.0
npm install
...see if that does the trick.

Sass-loader requires node-sass >=4 even if that exist

I executed a update to angular 6. And during ng serve -o I receive error that sass-loader expect node-sass.
After run ng serve -o I receive:
ERROR in ./src/sass/styles.scss (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/sass/styles.scss)
Module build failed: Error: `sass-loader` requires `node-sass` >=4. Please install a compatible version.
at Object.sassLoader (node_modules\sass-loader\lib\loader.js:31:19)
ERROR in ./src/app/app.component.scss
Module build failed: Error: `sass-loader` requires `node-sass` >=4. Please install a compatible version.
at Object.sassLoader (node_modules\sass-loader\lib\loader.js:31:19)
ERROR in x.component.scss
Module build failed: Error: `sass-loader` requires `node-sass` >=4. Please install a compatible version.
at Object.sassLoader (\node_modules\sass-loader\lib\loader.js:31:19)
ERROR in x.component.scss
Module build failed: Error: `sass-loader` requires `node-sass` >=4. Please install a compatible version.
at Object.sassLoader (loader.js:31:19)
ERROR in .x.component.scss
Module build failed: Error: `sass-loader` requires `node-sass` >=4. Please install a compatible version.
at Object.sassLoader (node_modules\sass-loader\lib\loader.js:31:19)
Obvisously I check everything (in my opinion) and I don't have idea what's going on.
Package.Json:
"devDependencies": {
"#angular-devkit/build-angular": "~0.6.0",
"#angular/cli": "6.0.0",
"#angular/compiler-cli": "6.0.0",
"#angular/language-service": "6.0.0",
"#types/jasmine": "~2.8.3",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.106",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-html-detailed-reporter": "^1.1.21",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "^1.0.4",
"karma-teamcity-reporter": "^1.1.0",
"phantomjs-prebuilt": "^2.1.16",
"protractor": "~5.1.2",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "2.7.2"
}
dir -l node_modules says:
...
05/07/2018 08:53 AM <DIR> node-sass
...
05/07/2018 08:53 AM <DIR> sass-loader
...
I executed:
npm rebuild node-sass
and secod approach:
I removed local node-module together with %User%\AppData\Roaming\npm-cache. then I removed lock file and execuded npm
npm cache clear --force
npm install
But still no success.
What do I miss ?
npm rebuild --force
aslo helps
I fixed it with
npm install node-sass
inside the project folder, and for the project, because installing it globally (with the -g option) didn't solve the issue.
I had same issue which I fixed using following steps:
Delete package-lock.json file.
Go to node_module folder and run rm -rf node_modules.
Run npm install
The package-lock.json file will auto-update with the new dependencies version.
hope it helps.
I fixed this issue using below steps:
Open package.json
Add which version you want to install of node-sass, for example "node-sass": "^4.12.0"
Run the installation command in command line interface (CLI): npm install node-sass
The issue will get resolved.
Simply run this code...
npm install --save node-sass
To solve your issue run this command
npm install --unsafe-perm
Following steps solved this issue
Delete node-saas folder in \Users\<user_id>\AppData\Roaming\npm-cache
Delete node-saas folder in <application_folder>/node_modules
Run npm install from <application_folder>
It could probably be a version mismatch. To install the working node-sass version, you can use
npm uninstall node-sass
npm install node-sass#4.14.0
And you can choose your version number based on the following table, and the node version you have installed, which you can check by node --version
You can find full info here
This has solved my issue
You can follow these steps:
First of all Delete package-lock.json file and node_modules.
and then Run npm install
The package-lock.json file will auto-update with the new dependencies version.

What could cause an error related to npm not being able to find a file? No contents in my node_modules subfolder. Why is that?

I'm trying to run npm install in the angular project folder I got from ASP.NET Boilerplate and I'm getting an error that is "related to npm not being able to find a file."
D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular>npm install
npm WARN deprecated #types/moment#2.13.0: This is a stub types definition for Moment (https://github.com/moment/moment). Moment provides its own type definitions, so you don't need #types/moment installed!
npm WARN codelyzer#3.2.2 requires a peer of #angular/compiler#^2.3.1 || >=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer#3.2.2 requires a peer of #angular/core#^2.3.1 || >=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\.staging\fsevents-8cc0601e\node_modules\are-we-there-yet' -> 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\.staging\are-we-there-yet-cedb4a6a'
npm ERR! path D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\#angular-devkit\build-optimizer\node_modules\typescript
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\#angular-devkit\build-optimizer\node_modules\typescript' -> 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\#angular-devkit\build-optimizer\node_modules\.typescript.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Jack\AppData\Roaming\npm-cache\_logs\2018-03-21T19_33_18_250Z-debug.log
I can clearly see that this is happening because my node_modules subfolder contains only a single folder structure with no files within it. That structure is:
node_modules\#angular-devkit\build-optimizer\node_modules
I have node 8.9.4, npm 5.6.0, and angular-CLI 1.5.0 installed as well as typescript 2.0.0. The latter two packages have been installed globally.
Here are the package.json file contents:
{
"name": "MyProject",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0 --port 4200",
"hmr": "ng serve --host 0.0.0.0 --port 4200 4201 --hmr -e=hmr",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.0.3",
"#angular/common": "^5.0.3",
"#angular/compiler": "^5.0.3",
"#angular/core": "^5.0.3",
"#angular/forms": "^5.0.3",
"#angular/http": "^5.0.3",
"#angular/platform-browser": "^5.0.3",
"#angular/platform-browser-dynamic": "^5.0.3",
"#angular/router": "^5.0.3",
"#aspnet/signalr": "1.0.0-preview1-28189",
"#types/bootstrap": "^3.3.33",
"#types/jquery": "^3.2.12",
"#types/jquery.blockui": "0.0.28",
"#types/jquery.validation": "^1.16.3",
"#types/lodash": "^4.14.62",
"#types/moment": "^2.13.0",
"#types/moment-timezone": "^0.2.34",
"#types/signalr": "^2.2.33",
"#types/toastr": "^2.1.33",
"abp-ng2-module": "^1.3.0",
"abp-web-resources": "^3.3.0",
"animate.css": "^3.5.2",
"block-ui": "^2.70.1",
"bootstrap": "^3.3.7",
"bootstrap-select": "^1.12.2",
"chart.js": "^2.6.0",
"core-js": "^2.4.1",
"famfamfam-flags": "^1.0.0",
"flot": "^0.8.0-alpha",
"font-awesome": "^4.7.0",
"jquery": "^3.1.1",
"jquery-countto": "^1.2.0",
"jquery-migrate": "^3.0.0",
"jquery-slimscroll": "^1.3.8",
"jquery-sparkline": "^2.4.0",
"js-cookie": "^2.1.4",
"lodash": "^4.17.4",
"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
"morris.js": "^0.5.0",
"ngx-bootstrap": "^2.0.2",
"ngx-pagination": "^3.0.3",
"node-waves": "^0.7.5",
"push.js": "1.0.4",
"raphael": "^2.2.7",
"rxjs": "^5.5.2",
"signalr": "^2.2.1",
"simple-line-icons": "^2.4.1",
"spin.js": "^2.3.2",
"sweetalert": "^2.0.8",
"toastr": "^2.1.2",
"ts-helpers": "^1.1.2",
"web-animations-js": "^2.3.1",
"zone.js": "0.8.18"
},
"devDependencies": {
"#angular/cli": "^1.5.4",
"#angular/compiler-cli": "^5.0.3",
"#angularclass/hmr": "^2.1.3",
"#types/jasmine": "^2.5.38",
"#types/node": "^8.0.27",
"codelyzer": "^3.1.2",
"jasmine-core": "^2.5.2",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^1.4.1",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"nswag": "^11.12.7",
"protractor": "^5.1.1",
"ts-node": "^3.3.0",
"tslint": "^5.7.0",
"typescript": "2.4.2"
}
}
When I run npm install, I can see the packages being downloaded into the .staging folder. At the point that the finalize command is run (see the log below), I can see that the package folders are being consolidated and copied somewhere, but that somewhere does not appear to be my node_modules subfolder other than the first set of subfolders as I have shown above. When the npm install completes, the .staging folder is deleted and all that I have left is that partial folder structure.
Admittedly I am new to Node development - I usually work on our ASP.NET Web API backends. I'm trying to get my development environment in sync with our front-end developer's development environment. I have spent most of the day looking for a solution. I've tried uninstalling and reinstalling Node. I've tried different versions that match our front-end developer's environment. I've tried using the latest versions of angular-CLI and typescript and have fallen back to the versions I reference above in hopes that the "requires a peer" warnings would be resolved. I have searched for similar answers on this site. The closest one I have found remains unanswered.
Here is the end of the "complete log" referenced in the npm error output:
19577 silly saveTree | `-- tsutils#2.22.2
19577 silly saveTree +-- typescript#2.4.2
19577 silly saveTree +-- web-animations-js#2.3.1
19577 silly saveTree `-- zone.js#0.8.18
19578 warn codelyzer#3.2.2 requires a peer of #angular/compiler#^2.3.1 || >=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.
19579 warn codelyzer#3.2.2 requires a peer of #angular/core#^2.3.1 || >=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.
19580 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\fsevents):
19581 warn optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\.staging\fsevents-8cc0601e\node_modules\are-we-there-yet' -> 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\.staging\are-we-there-yet-cedb4a6a'
19582 verbose optional SKIPPING OPTIONAL DEPENDENCY:
19582 verbose optional Please try running this command again as root/Administrator.
19583 verbose stack Error: ENOENT: no such file or directory, rename 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\#angular-devkit\build-optimizer\node_modules\typescript' -> 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\#angular-devkit\build-optimizer\node_modules\.typescript.DELETE'
19584 verbose cwd D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular
19585 verbose Windows_NT 10.0.16299
19586 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
19587 verbose node v8.9.4
19588 verbose npm v5.6.0
19589 error path D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\#angular-devkit\build-optimizer\node_modules\typescript
19590 error code ENOENT
19591 error errno -4058
19592 error syscall rename
19593 error enoent ENOENT: no such file or directory, rename 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\#angular-devkit\build-optimizer\node_modules\typescript' -> 'D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular\node_modules\#angular-devkit\build-optimizer\node_modules\.typescript.DELETE'
19594 error enoent This is related to npm not being able to find a file.
19595 verbose exit [ -4058, true ]
Please advise.
The following steps work for me:
npm cache clean -f
rm -rf node_modules
npm i
It might be related to corruption in Angular Packages or incompatibility of packages.
Please follow the below steps to solve the issue.
Delete node_modules folder manually.
Install Node ( https://nodejs.org/en/download ).
Install Yarn ( https://yarnpkg.com/en/docs/install ).
Open command prompt , go to path angular folder and run Yarn.
Run angular\nswag\refresh.bat.
Run npm start from the angular folder.
Update
ASP.NET Boilerplate suggests here to use yarn because npm has some problems. It is slow and can not consistently resolve dependencies, yarn solves those problems and it is compatible to npm as well.
I had the SAME issue today and it was driving me nuts!!! What I had done was upgrade to node 8.10 and upgrade my NPM to the latest I uninstalled angular CLI
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
I then verified my Cache from NPM if it wasn't up to date I cleaned it and ran the install again
if npm version is < 5 then use npm cache clean --force
npm install -g #angular/cli#latest
and created a new project file and create a new angular project.
Try the following steps:
1. Make sure you have the latest npm (npm install -g npm).
2. Add an exception to your antivirus to ignore the node_modules folder in your project.
3. $ rm -rf node_modules package-lock.json .
4. $ npm install
Following what #viveknuna suggested, I upgraded to the latest version of node.js and npm using the downloaded installer. I also installed the latest version of yarn using a downloaded installer. Then, as you can see below, I upgraded angular-cli and typescript. Here's what that process looked like:
D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular>npm install -g #angular/cli#latest
C:\Users\Jack\AppData\Roaming\npm\ng -> C:\Users\Jack\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\#angular\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ #angular/cli#1.7.3
added 75 packages, removed 166 packages, updated 61 packages and moved 24 packages in 29.084s
D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular>npm install -g typescript
C:\Users\Jack\AppData\Roaming\npm\tsserver -> C:\Users\Jack\AppData\Roaming\npm\node_modules\typescript\bin\tsserver
C:\Users\Jack\AppData\Roaming\npm\tsc -> C:\Users\Jack\AppData\Roaming\npm\node_modules\typescript\bin\tsc
+ typescript#2.7.2
updated 1 package in 2.427s
D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular>node -v
v8.10.0
D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular>npm -v
5.6.0
D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular>yarn --version
1.5.1
Thereafter, I ran yarn and npm start in my angular folder and all appears to be well. Here's what that looked like:
D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular>yarn
yarn install v1.5.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents#1.1.3: The platform "win32" is incompatible with this module.
info "fsevents#1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "#angular/cli > #schematics/angular#0.1.10" has incorrect peer dependency "#angular-devkit/schematics#0.0.40".
warning "#angular/cli > #angular-devkit/schematics > #schematics/schematics#0.0.10" has incorrect peer dependency "#angular-devkit/schematics#0.0.40".
warning " > codelyzer#3.2.2" has incorrect peer dependency "#angular/compiler#^2.3.1 || >=4.0.0-beta <5.0.0".
warning " > codelyzer#3.2.2" has incorrect peer dependency "#angular/core#^2.3.1 || >=4.0.0-beta <5.0.0".
[4/4] Building fresh packages...
Done in 232.79s.
D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular>npm start
> MyProject#0.0.0 start D:\Dev\AspNetBoilerplate\MyProject\3.5.0\angular
> ng serve --host 0.0.0.0 --port 4200
** NG Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **
Date: 2018-03-22T13:17:28.935Z
Hash: 8f226b6fa069b7c201ea
Time: 22494ms
chunk {account.module} account.module.chunk.js () 129 kB [rendered]
chunk {app.module} app.module.chunk.js () 497 kB [rendered]
chunk {common} common.chunk.js (common) 1.46 MB [rendered]
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 515 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 1.1 MB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 1.53 MB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 15.1 MB [initial] [rendered]
webpack: Compiled successfully.
If it happens, then it means you have to upgrade your node.js. Simply uninstall your current node from your pc or mac and download the latest version from https://nodejs.org/en/
In my case
npm cache clean --force
Also not working so, I use
yarn
First, install yarn globally
npm i -g yarn
Then instead of "npm start", I do,
yarn add
This works for me.
I had faced the same problem. After google search I found this solution:
'git' is not recognized as an internal or external command
Check this out hope your problem will be solved
In my case, this error happened with a new project.
none of the proposed solutions here worked, so I simply reinstalled all the packages and started working correctly.
In my case I tried to run npm i firebase#7.8.2 and got the error because the dev server was running in another terminal on vsc. Hit ctrl+c, y to stop it in that terminal, and then installation works.
In my case, I had to create a new app, reinstall my node packages, and copy my src document over. That worked.
Change your firebase.json from:
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
}
}
To:
{
"functions": {
}
}
I was trying to do it in a folder inside dropbox. I think dropbox was locking files as it uploaded them or something and that didn't work. It would fail in different places.

Update Angular2 to latest version

I am trying to update Angular2 to the latest version release candidate 4.
I have executed npm outdated and edited accordingly the package.json file.
Then I have executed npm update which failed. I haven't saved the error message. In the following I googled and tried several different npm commands. Unfortunately I cannot recall them.
The current status is, that npm update does not show anything; so seems to work.
The command npm start starts the server, but the browser console displays multiple errors. The first is:
http://localhost:3000/node_modules/#angular/platform-browser-dynamic/platform-browser-dynamic.umd.js Failed to load resource: the server responded with a status of 404 (Not Found)
Besides npm install shows the following warnings:
typings WARN deprecated 2016-06-02: "registry:dt/core-js#0.0.0+20160317120654" is deprecated (updated, replaced or removed)
typings WARN deprecated 2016-06-22: "registry:dt/node#4.0.0+20160509154515" is deprecated (updated, replaced or removed)
typings WARN deprecated 2016-06-22: "registry:dt/jasmine#2.2.0+20160505161446" is deprecated (updated, replaced or removed)
├── core-js (global)
├── jasmine (global)
└── node (global)
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
npm WARN optional Skipping failed optional dependency /lite-server/browser-sync/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
npm WARN #angular/core#2.0.0-rc.4 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
npm WARN #angular/http#2.0.0-rc.4 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
npm WARN #angular/router#3.0.0-beta.2 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
npm WARN #angular/router-deprecated#2.0.0-rc.1 requires a peer of #angular/core#2.0.0-rc.1 but none was installed.
npm WARN #angular/router-deprecated#2.0.0-rc.1 requires a peer of #angular/common#2.0.0-rc.1 but none was installed.
npm WARN #angular/router-deprecated#2.0.0-rc.1 requires a peer of #angular/platform-browser#2.0.0-rc.1 but none was installed.
npm WARN angular2-in-memory-web-api#0.0.14 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
The package.json relevant parts are currently:
"dependencies": {
"#angular/common": "2.0.0-rc.4",
"#angular/compiler": "2.0.0-rc.4",
"#angular/core": "2.0.0-rc.4",
"#angular/http": "2.0.0-rc.4",
"#angular/platform-browser": "2.0.0-rc.4",
"#angular/platform-browser-dynamic": "2.0.0-rc.4",
"#angular/router": "3.0.0-beta.2",
"#angular/upgrade": "2.0.0-rc.4",
"angular2-in-memory-web-api": "0.0.14",
"angular2-uuid": "^1.0.7",
"bootstrap": "^3.3.6",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.9",
"systemjs": "0.19.31",
"zone.js": "^0.6.12"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings": "^1.0.4",
"canonical-path": "0.0.2",
"http-server": "^0.9.0",
"tslint": "^3.7.4",
"lodash": "^4.11.1",
"jasmine-core": "~2.4.1",
"karma": "^1.1.0",
"karma-chrome-launcher": "^1.0.1",
"karma-cli": "^1.0.1",
"karma-htmlfile-reporter": "^0.3.4",
"karma-jasmine": "^1.0.2",
"protractor": "^3.3.0",
"rimraf": "^2.5.2"
},
Follow these steps:
Delete node_modules folder.
Take latest package.json from https://angular.io/guide/quickstart
Run 'npm install' command.
In typings.json one must update to new registry value, if problem shows up for core-js
"core-js": "registry:dt/core-js#0.0.0+20160317120654"
to
"core-js": "registry:dt/core-js#0.0.0+20160725163759"
https://github.com/mgechev/angular2-seed/commit/8a8c64e0e8b18cd0c19c1ab2f1dc71a30bbd6174
This might be outdated but your typings were never addressed. Given that you would want to always keep them up to date. Also for anyone else seeking to know about the update process
Here is how you could update/reinstall them
Example:
For your node to update it simply type
typings install dt~node --save --global
The following will update your node typings which would be in /typings/global/node
If you did not have node the same command would suffice and your index.d.ts will also be update with a new entry!

Resources