Npm install error EPERM Operation not permitted - node.js

So when trying to run the angular4 project today my first error was : npm install eperm operation not permitted so I thought to delete my node modules folder and retry. But running npm install I am running in to this error npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start". I've closed vscode to try and run the install to make sure nothing was locking it. I've tried npm cache clean but results in errors.
Todays latest struggles :
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli '#angular/cli#latest' ]
2 info using npm#5.5.1
3 info using node#v8.9.3
4 verbose npm-session 2a0bb102467943cf
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 error cb() never called!
Admin Results:
Any suggestions?
My package.json looks like this :
{
"name": "gamemanagement",
"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.1",
"#angular/compiler": "^5.0.1",
"#angular/compiler-cli": "^5.0.1",
"#angular/core": "^5.0.1",
"#angular/forms": "^5.0.1",
"#angular/http": "^5.0.1",
"#angular/material": "^5.0.0-rc0",
"#angular/platform-browser": "^5.0.1",
"#angular/platform-browser-dynamic": "^5.0.1",
"#angular/platform-server": "^5.0.1",
"#angular/router": "^5.0.1",
"#ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
"angular2-moment": "^1.7.0",
"angular2-text-mask": "^8.0.4",
"angularfire2": "5.0.0-rc.3",
"ap-angular2-fullcalendar": "^1.3.5",
"bootstrap": "4.0.0-beta",
"core-js": "^2.4.1",
"firebase": "4.6.2",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"moment": "^2.19.3",
"ng2-date-picker": "^2.6.2",
"popper.js": "^1.12.9",
"rxjs": "^5.4.2",
"sweetalert2": "^7.0.9",
"typescript": "^2.6.1",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "^1.5.3",
"#angular/compiler-cli": "^4.2.4",
"#angular/language-service": "^4.2.4",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"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.3.3"
}
}

I had the same issue. After cache clean and updating npm everything is ok. So try to run:
npm cache clean --force
npm install -g npm#latest

There are 2 solutions for this
you can run "npm cache clean"
you run the command prompt in admin mode.

macOS catalina ,
npm init
got error
operation not permitted, uv_cwd
step 1: go to parent folder
cd ../
step 2: go to your project folder again,
cd your-project-folder
That is it. it works.

Try below setps, hope this helps.
Update Node.js
npm cache clean command in Command prompt, try as admin
check node proxy settings if persist remove them with below
npm config delete http-proxy
npm config delete https-proxy

Install by yourself the module that is giving the error.
After spending many hours and trying all the possible suggestions, I found that installing the specific module mentioned by the error globally fixed the issue:
For Example:
npm ERR! { Error: EPERM: operation not permitted, unlink 'Path\Docume
nts\AngularProjects\my-sample-app333\node_modules.staging#angular\core-a3d1aa4
8\ bundles\core.umd.js
I run: npm install -global #angular/core
and it fixed it for me! Finally!!

Just try npm cache clean quick and simple :)

I tried everything above but it did not work for me.
I copied all content of package.json and deleted the file. Then, I created a new file and copied all there and I saved it as package.json
That fixed everything

100% sure
Firstly delete the project folder. eg: myapp1
Then run ->npm cache clean --force command
Retype the command that gives error previously.

I also faced the same issue but once I removed node_modules folder along with package-lock.json from the project and then I re-installed entire thing again with npm i it worked for me.

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.

Heroku-postbuild error when deploying nodejs and angular to heroku

I have a app that is currently deployed on heroku and working perfectly fine. I created a new heroku app and tried to run the same branch. I installed nodejs and all the configuration is the same but for some reason the build is failing at heroku-postbuild: "ng build --prod". It works fine on the previous instance I have on heroku but wont work on the new one. I don't know what i am missing as the information on the error is minimal. I am attaching my package.json as well as the error message I get. any help will be appreciated and let me know if you need me to upload anything else.
package.json
{
"name": "eserver",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"main": "server.js",
"heroku-postbuild": "ng build --prod",
"preinstall": "npm install -g #angular/cli #angular/compiler-cli typescript",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^11.0.5",
"#angular/cdk": "^11.0.3",
"#angular/common": "^11.0.5",
"#angular/compiler": "11.0.5",
"#angular/compiler-cli": "^11.0.5",
"#angular/core": "^11.0.5",
"#angular/flex-layout": "^11.0.0-beta.33",
"#angular/forms": "^11.0.5",
"#angular/localize": "^11.0.5",
"#angular/material": "^11.0.3",
"#angular/platform-browser": "11.0.5",
"#angular/platform-browser-dynamic": "11.0.5",
"#angular/router": "11.0.5",
"ng2-charts-schematics": "^0.1.7",
"#angular-devkit/build-angular": "^0.1100.5",
"#angular/cli": "11.0.5",
"#angular/language-service": "^11.0.5",
"#fortawesome/fontawesome-free": "^5.15.1",
"#types/chartist": "^0.11.0",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.3",
"#types/lodash": "^4.14.135",
"#types/node": "^8.10.66",
"#types/uuid": "^8.3.0",
"angular-cli-ghpages": "^0.6.2",
"protractor": "^7.0.0",
"ts-node": "~5.0.1",
"#ng-bootstrap/ng-bootstrap": "^5.3.1",
"#ng-bootstrap/schematics": "^2.0.0-alpha.1",
"#ngtools/webpack": "^11.0.5",
"#ngx-translate/core": "13.0.0",
"#ngx-translate/http-loader": "^4.0.0",
"#types/chart.js": "^2.7.42",
"#types/express": "^4.17.0",
"#types/w3c-web-usb": "^1.0.4",
"#types/web-bluetooth": "0.0.4",
"angular-bootstrap-md": "^7.4.3",
"angular-cc-library": "^2.1.2",
"angular-notifier": "^4.1.1",
"angular-responsive-carousel": "^2.0.2",
"angular5-csv": "^0.2.11",
"apexcharts": "^3.25.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"bootstrap": "^4.5.3",
"chart.js": "^2.9.4",
"chartist": "^0.11.4",
"config": "^3.3.6",
"core-js": "^2.5.4",
"cors": "^2.8.5",
"css-loader": "^2.1.0",
"dotenv": "^6.1.0",
"exec": "^0.2.1",
"express": "^4.16.4",
"express-jwt": "^5.3.1",
"express-sslify": "^1.2.0",
"font-awesome": "^4.7.0",
"fontawesome": "^5.6.3",
"got": "^11.8.1",
"hammerjs": "^2.0.8",
"jsonwebtoken": "^8.2.2",
"ldbutton": "^1.0.2",
"lodash": "^4.17.11",
"mat-table-exporter": "^1.0.2",
"material-design-lite": "^1.3.0",
"mdb-angular-ui-kit": "^1.0.0-alpha3",
"mdbootstrap": "^4.19.2",
"mongodb": "^3.0.10",
"mongoose": "^5.1.4",
"ng-apexcharts": "^1.5.8",
"ng-chartist": "^4.1.0",
"ng-multiselect-dropdown": "^0.2.3",
"ng-thermal-print": "^1.0.3",
"ng2-charts": "^2.4.2",
"ngx-autosize": "^1.8.4",
"ngx-bootstrap": "^6.2.0",
"ngx-chess-board": "^2.0.7",
"node-sass": "^4.14.1",
"path": "^0.12.7",
"popper.js": "^1.15.0",
"pusher": "^2.2.0",
"pusher-js": "^4.4.0",
"readable-stream": "^3.6.0",
"remote-pay-cloud": "3.1.0",
"remote-pay-cloud-api": "^4.0.3",
"request": "^2.88.2",
"request-promise": "^4.2.4",
"resize-base64": "^1.0.12",
"rootpath": "^0.1.2",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.3.3",
"time-ago-pipe": "^1.3.2",
"tslib": "^1.9.0",
"typescript": "4.0.5",
"uuid": "^3.3.2",
"web-animations-js": "^2.3.2",
"zone.js": "~0.10.3"
},
"devDependencies": {
"#angular-devkit/core": "^11.0.5",
"#angular-devkit/schematics": "^11.0.5",
"codelyzer": "^5.0.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~5.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ng2-charts-schematics": "^0.1.7",
"protractor": "^7.0.0",
"ts-node": "~5.0.1",
"tslint": "~6.1.3"
},
"engines": {
"node": "10.13",
"npm": "6.9.0"
}
}
log and Error I am getting when deploying on heroku:
Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 10.13
engines.npm (package.json): 6.9.0
Resolving node version 10.13...
Downloading and installing node 10.13.0...
Bootstrapping npm 6.9.0 (replacing 6.4.1)...
npm 6.9.0 installed
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules (package.json)
> eserver#0.0.0 preinstall /tmp/build_d00ecea7
> npm install -g #angular/cli #angular/compiler-cli typescript
/tmp/build_d00ecea7/.heroku/node/bin/ng -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/cli/bin/ng.js
/tmp/build_d00ecea7/.heroku/node/bin/ngcc -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/compiler-cli/bundles/ngcc/main-ngcc.js
/tmp/build_d00ecea7/.heroku/node/bin/ngc -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/compiler-cli/bundles/src/bin/ngc.js
/tmp/build_d00ecea7/.heroku/node/bin/ng-xi18n -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/compiler-cli/bundles/src/bin/ng_xi18n.js
/tmp/build_d00ecea7/.heroku/node/bin/tsc -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/typescript/bin/tsc
/tmp/build_d00ecea7/.heroku/node/bin/tsserver -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/typescript/bin/tsserver
> #angular/cli#13.1.4 postinstall /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/cli
> node ./bin/postinstall/script.js
+ #angular/cli#13.1.4
+ typescript#4.5.5
+ #angular/compiler-cli#13.1.3
added 271 packages from 168 contributors in 10.621s
audited 2004 packages in 17.813s
found 45 vulnerabilities (2 low, 26 moderate, 17 high)
run `npm audit fix` to fix them, or `npm audit` for details
-----> Build
Detected both "build" and "heroku-postbuild" scripts
Running heroku-postbuild
> eserver#0.0.0 heroku-postbuild /tmp/build_d00ecea7
> npm i && ng build --prod
> eserver#0.0.0 preinstall /tmp/build_d00ecea7
> npm install -g #angular/cli #angular/compiler-cli typescript
/tmp/build_d00ecea7/.heroku/node/bin/ng -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/cli/bin/ng.js
/tmp/build_d00ecea7/.heroku/node/bin/ngc -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/compiler-cli/bundles/src/bin/ngc.js
/tmp/build_d00ecea7/.heroku/node/bin/ng-xi18n -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/compiler-cli/bundles/src/bin/ng_xi18n.js
/tmp/build_d00ecea7/.heroku/node/bin/ngcc -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/compiler-cli/bundles/ngcc/main-ngcc.js
/tmp/build_d00ecea7/.heroku/node/bin/tsc -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/typescript/bin/tsc
/tmp/build_d00ecea7/.heroku/node/bin/tsserver -> /tmp/build_d00ecea7/.heroku/node/lib/node_modules/typescript/bin/tsserver
> #angular/cli#13.1.4 postinstall /tmp/build_d00ecea7/.heroku/node/lib/node_modules/#angular/cli
> node ./bin/postinstall/script.js
+ #angular/compiler-cli#13.1.3
+ #angular/cli#13.1.4
+ typescript#4.5.5
updated 3 packages in 3.453s
audited 2004 packages in 11.332s
found 45 vulnerabilities (2 low, 26 moderate, 17 high)
run `npm audit fix` to fix them, or `npm audit` for details
'node-sass' usage is deprecated and will be removed in a future major version. To opt-out of the deprecated behaviour and start using 'sass' uninstall 'node-sass'.
- Generating browser application bundles...
✔ Browser application bundle generation complete.
Error: compiler_1.getMissingNgModuleMetadataErrorData is not a function
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! eserver#0.0.0 heroku-postbuild: `npm i && ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eserver#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.CSj5i/_logs/2022-01-26T03_37_12_096Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
Check if HEROKU_API_KEY is correct and that heroku_app_name is unique. Also this line seems sketcy: Detected both "build" and "heroku-postbuild" scripts Running heroku-postbuild. Maybe refactor heroku-postbuild in build and run only build.
"scripts": {
"ng": "ng",
"main": "server.js",
"preinstall": "npm install -g #angular/cli #angular/compiler-cli typescript",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
I managed to solve the issue by changing the version of #angular/compiler-cli and #angular/compiler versions.

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.

Can't build Angular project after upgrade from 8 to 9

I've done an upgrade of my Angular project from 8 to 9 by using the ng update tool. Locally (Windows) everything works fine, but when I'm trying to build the project in docker, I get the following error:
Step 6/11 : RUN npm run build
---> Running in d60f739a56f6
> check-it-frontend#0.0.0 build /app
> ng build --prod
Compiling #angular/core : es2015 as esm2015
ERROR in EINVAL: invalid argument, rename '/app/node_modules/#angular/core/core.d.ts' -> '/app/node_modules/#angular/core/core.d.ts.__ivy_ngcc_bak'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! check-it-frontend#0.0.0 build: `ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the check-it-frontend#0.0.0 build 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! /root/.npm/_logs/2020-03-20T11_44_02_696Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
The dockerfile:
FROM node:13.10.1-stretch as base
RUN apt-get update -qq && apt-get install -y build-essential
ADD . /app
WORKDIR /app
RUN npm ci
RUN npm run build
Dependencies:
"dependencies": {
"#angular/animations": "^9.0.7",
"#angular/cdk": "^8.2.3",
"#angular/common": "^9.0.7",
"#angular/compiler": "^9.0.7",
"#angular/core": "^9.0.7",
"#angular/forms": "^9.0.7",
"#angular/material": "^8.2.3",
"#angular/platform-browser": "^9.0.7",
"#angular/platform-browser-dynamic": "^9.0.7",
"#angular/router": "^9.0.7",
"core-js": "^2.4.1",
"rxjs": "^6.5.4",
"rxjs-compat": "^6.0.0-rc.0",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.900.7",
"#angular/cli": "^9.0.7",
"#angular/compiler-cli": "^9.0.7",
"#angular/language-service": "^9.0.7",
"#types/jasmine": "~2.8.3",
"#types/jasminewd2": "~2.0.2",
"#types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.13.1",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~3.7.5"
}
Anything I can do to fix it? Images for Angular 8 were fine. I've tried different node images, but nothing helped...
I'm not exactly sure what your issue is or what's causing it, but I did a quick search and stumbled upon this github issue. It concerns parallel builds (which I don't think is your case), but I thought it could still apply here since the error happens during the compilation of angular core.
The suggested workaround is to run the angular compatibility compiler (ngcc) as a postinstall script, instead of having the build trigger it itself.
Modify your package.json file and add the following to the scripts section:
"postinstall": "ngcc

Angular not working after cloning to a different PC

so I got a new pc and I wanted to pass my angular project through github.
I used 1.npm i 2.npm i #angular/cli#latest -D 3. ng update
And Everytime I'm trying to run the project with ng s it keeps sending me this error:
This version of CLI is only compatible with Angular versions ^9.0.0-beta || >=9.0.0 <10.0.0,
but Angular version 8.2.14 was found instead.
Please visit the link below to find instructions on how to update Angular.
https://angular-update-guide.firebaseapp.com/
I tried using the instructions at the link.
This is my Angular version when typing ng --version:
Angular CLI: 9.0.1
Node: 12.16.0
This is the package.json:
{
"name": "empire-gaming",
"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-redux/store": "^10.0.0",
"#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.2.1",
"#ngrx/store": "^8.6.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"hammerjs": "^2.0.8",
"mongoose": "^5.8.10",
"ngx-bootstrap": "^5.3.2",
"redux": "^4.0.5",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.803.22",
"#angular/cli": "^9.0.1",
"#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.4.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.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
I'm really clueless about it... I would be glad if you help me.
The version of Angular that you are using in the project is lower than the version that needed for the latest version of Angular CLI.
I would recommend you to downgrade the Angular CLI version to 8.3.25
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#8.3.25
And change the version of Angular CLI in your devDependencies:
npm install -D #angular/cli#8.3.25
First step install Angular globally.
npm install -g #angular/cli#latest
Run Update command to get a list of all dependencies required to be upgraded.
ng update
Next Run update command as below for each individual Angular core package
ng update #angular/cli #angular/core
If you want to force the changes use: –force and –allow-dirty flags command additionally to fix all other pending issues.
ng update #angular/cli #angular/core --allow-dirty --force
This is worked for me
Delete folder node_modules and package-lock.json
then execute: "npm install"
in short:
go to project directory in terminal/command prompt and execute following commands
rm -fr ./node_modules
rm -fr ./package-lock.json
npm install
ng serve -o
I know this is an old thread, but in my experience changing the app package.json file("#angular-devkit/build-angular") to another compatible version works for me :). After the file change, you will be needed to run again these commands "ng update", "npm install" & "ng server"

Resources