Home > database >  npm install is giving so many errors
npm install is giving so many errors

Time:11-29

I have installed windows 11 in my newly bought laptop, and installed Nodejs, Angular Cli, but when I run npm install in my project everything is giving error, I tried a lot , but could not solve it.

upgrade downgrade node. update all node packages. clear cache etc.

Note:

node version: v16.13.0
npm version: 8.1.4
angular cli version: Angular CLI: 10.1.7

tried all these, but could not solve it.

help me with step by step solutions.

package.json

{
  "name": "public_services",
  "version": "1.0.0",
  "license": "",
  "scripts": {
  "ng": "ng",
  "start": "ng serve",
  "build": "ng build",
  "test": "ng test",
  "lint": "ng lint",
  "e2e": "ng e2e"
 },
 "private": true,
 "dependencies": {
   "@angular/animations": "~10.1.5",
   "@angular/cdk": "^10.2.5",
   "@angular/common": "~10.1.5",
   "@angular/compiler": "~10.1.5",
   "@angular/core": "~10.1.5",
   "@angular/forms": "~10.1.5",
   "@angular/platform-browser": "~10.1.5",
   "@angular/platform-browser-dynamic": "~10.1.5",
   "@angular/router": "10.1.5",
   "@fortawesome/angular-fontawesome": "^0.2.0",
   "@fortawesome/fontawesome-svg-core": "^1.2.28",
   "@fortawesome/free-brands-svg-icons": "^5.13.0",
   "@fortawesome/free-regular-svg-icons": "^5.13.0",
   "@fortawesome/free-solid-svg-icons": "^5.13.0",
   "@ng-bootstrap/ng-bootstrap": "4.1.3",
   "@ng-select/ng-select": "^3.7.3",
   "@ngx-translate/core": "11.0.1",
   "@ngx-translate/http-loader": "4.0.0",
   "@swimlane/ngx-charts": "^19.1.0",
   "@swimlane/ngx-datatable": "^16.0.3",
   "angular-archwizard": "6.1.0",
   "bootstrap": "4.3.1",
   "classlist.js": "1.1.20150312",
   "core-js": "3.1.3",
   "date-fns": "1.30.1",
   "gulp": "4.0.2",
   "hopscotch": "0.3.1",
   "intl": "1.2.5",
   "moment": "2.24.0",
   "ng-lazyload-image": "^9.0.1",
   "ng2-file-upload": "1.3.0",
   "ng2-img-cropper": "0.9.0",
   "ngx-bootstrap": "^5.3.2",
   "ngx-chips": "2.0.0-beta.0",
   "ngx-datatable": "^1.0.3",
   "ngx-dropzone-wrapper": "^9.0.0",
   "ngx-perfect-scrollbar": "7.2.1",
   "ngx-toastr": "10.0.4",
   "node-sass": "^4.14.1",
   "nouislider": "13.1.5",
   "prismjs": "1.16.0",
   "resize-observer-polyfill": "1.5.1",
   "rxjs": "6.6.3",
   "screenfull": "4.2.0",
   "sweetalert2": "8.11.6",
   "tslib": "^2.0.0",
   "web-animations-js": "^2.3.2",
   "xlsx": "^0.16.8",
   "zone.js": "~0.10.2"
 },
   "devDependencies": {
    "@angular-devkit/build-angular": "~0.1001.6",
    "@angular/cli": "~10.1.6",
    "@angular/compiler-cli": "~10.1.5",
    "@angular/language-service": "~10.1.5",
    "@types/core-js": "2.5.0",
    "@types/jasmine": "^3.3.16",
    "@types/jasminewd2": "~2.0.3",
    "@types/jquery": "^3.5.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-cli": "~2.0.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
     "rxjs-compat": "6.5.2",
   "ts-node": "~7.0.0",
   "tslint": "~6.1.0",
   "typescript": "~4.0.3"
  } 
}

After npm install the errors

PS C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend> npm i
npm ERR! code 1
npm ERR! path C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR! Build started 11/29/2021 10:03:34 AM.
npm ERR! MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".
npm ERR!
npm ERR! Build FAILED.
npm ERR!
npm ERR!   MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".
npm ERR!
npm ERR!     0 Warning(s)
npm ERR!     1 Error(s)
npm ERR!
npm ERR! Time Elapsed 00:00:00.04
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Users\\SAYED-SADAT\\Desktop\\data\\coding\\itsm-frontend\\itsm-frontend\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.13.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "c:\python27\python.exe" in the PATH
npm ERR! gyp verb `which` failed Error: not found: c:\python27\python.exe
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\which\which.js:13:12)    
npm ERR! gyp verb `which` failed     at F (C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb `which` failed  c:\python27\python.exe Error: not found: c:\python27\python.exe
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\which\which.js:13:12)    
npm ERR! gyp verb `which` failed     at F (C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb could not find "c:\python27\python.exe". checking python launcher
npm ERR! gyp verb check python launcher python executable found: "C:\\Users\\SAYED-SADAT\\.windows-build-tools\\python27\\python.exe"
npm ERR! gyp verb check python version `C:\Users\SAYED-SADAT\.windows-build-tools\python27\python.exe -c "import sys; print "2.7.15
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.13.0
npm ERR! gyp verb command install [ '16.13.0' ]
npm ERR! gyp verb install input version string "16.13.0"
npm ERR! gyp verb install installing version: 16.13.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.13.0
npm ERR! gyp verb build dir attempting to create "build" dir: C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\node-sass\build      
npm ERR! gyp verb build dir "build" dir needed to be created? C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\node-sass\build      
npm ERR! gyp verb Not using VS2017: No usable installation of VS2017 found
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\node-sass\build\config.gypi
npm ERR! (node:11248) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\node-sass\config.gypi        
npm ERR! gyp verb common.gypi checking for gypi file: C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\node-sass\common.gypi        
npm ERR! gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\node-gyp\lib\build.js:262:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\SAYED-SADAT\\Desktop\\data\\coding\\itsm-frontend\\itsm-frontend\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Users\SAYED-SADAT\Desktop\data\coding\itsm-frontend\itsm-frontend\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.13.0npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\SAYED-SADAT\AppData\Local\npm-cache\_logs\2021-11-29T05_33_36_625Z-debug.log

CodePudding user response:

How much more clear can npm be?!

Error: not found: c:\python27\python.exe

some packages require python2.7; others look for python and will accept Python 3. It's a pain; especially for those of us that don't use Python otherwise. But your problem is basic - install Python and try again

CodePudding user response:

This is related to version mismatch between node.js and node-sass in package.json. You can check here all supported versions. https://github.com/sass/node-sass

You will either need to change node.js or node-sass version and do npm install again.

  • Related