安装 Ngx-Admin 时出错

errors while Installing Ngx-Admin

我是 Angular 的新手,我尝试安装 ngx-admin 模板,但遇到了这些错误。如何修复这些错误?

 npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
    npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
    npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM `enter code here`has moved to "coffeescript" (no hyphen)
    npm WARN deprecated @types/googlemaps@3.43.3: Types for the Google Maps browser API have moved to @types/google.maps. Note: these types are not for the googlemaps npm package, which is a Node API.
    npm WARN deprecated viz.js@1.8.0: no longer supported
    npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
    npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 
    for more information.
    npm WARN deprecated core-js@2.5.1: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because 
    of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, 
    upgrade your dependencies to the actual version of core-js.
    npm WARN deprecated ckeditor@4.7.3: We have renamed the @ckeditor package. New versions are available under the @ckeditor4 name.
    npm ERR! code 1
    npm ERR! path C:\Users\admin\ngx-admin\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\admin\ngx-admin\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
    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\admin\ngx-admin\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.14.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 "python2" in the PATH
    npm ERR! gyp verb `which` failed Error: not found: python2
    npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\admin\ngx-admin\node_modules\which\which.js:13:12)
    npm ERR! gyp verb `which` failed     at F (C:\Users\admin\ngx-admin\node_modules\which\which.js:68:19)
    npm ERR! gyp verb `which` failed     at E (C:\Users\admin\ngx-admin\node_modules\which\which.js:80:29)
    npm ERR! gyp verb `which` failed     at C:\Users\admin\ngx-admin\node_modules\which\which.js:89:16
    npm ERR! gyp verb `which` failed     at C:\Users\admin\ngx-admin\node_modules\isexe\index.js:42:5
    npm ERR! gyp verb `which` failed     at C:\Users\admin\ngx-admin\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  python2 Error: not found: python2
    npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\admin\ngx-admin\node_modules\which\which.js:13:12)
    npm ERR! gyp verb `which` failed     at F (C:\Users\admin\ngx-admin\node_modules\which\which.js:68:19)
    npm ERR! gyp verb `which` failed     at E (C:\Users\admin\ngx-admin\node_modules\which\which.js:80:29)
    npm ERR! gyp verb `which` failed at C:\Users\admin\ngx-admin\node_modules\which\which.js:89:16
    npm ERR! gyp verb `which` failed at C:\Users\admin\ngx-admin\node_modules\isexe\index.js:42:5
    npm ERR! gyp verb `which` failed at C:\Users\admin\ngx-admin\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 check python checking for Python executable "python" in the PATH
    npm ERR! gyp verb `which` failed Error: not found: python
    npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\admin\ngx-admin\node_modules\which\which.js:13:12)
    npm ERR! gyp verb `which` failed     at F (C:\Users\admin\ngx-admin\node_modules\which\which.js:68:19)
    npm ERR! gyp verb `which` failed     at E (C:\Users\admin\ngx-admin\node_modules\which\which.js:80:29)
    npm ERR! gyp verb `which` failed     at C:\Users\admin\ngx-admin\node_modules\which\which.js:89:16
    npm ERR! gyp verb `which` failed     at C:\Users\admin\ngx-admin\node_modules\isexe\index.js:42:5
    npm ERR! gyp verb `which` failed     at C:\Users\admin\ngx-admin\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  python Error: not found: python
    npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\admin\ngx-admin\node_modules\which\which.js:13:12)
    npm ERR! gyp verb `which` failed     at F (C:\Users\admin\ngx-admin\node_modules\which\which.js:68:19)
    npm ERR! gyp verb `which` failed     at E (C:\Users\admin\ngx-admin\node_modules\which\which.js:80:29)
    npm ERR! gyp verb `which` failed     at C:\Users\admin\ngx-admin\node_modules\which\which.js:89:16
    npm ERR! gyp verb `which` failed     at C:\Users\admin\ngx-admin\node_modules\isexe\index.js:42:5
    npm ERR! gyp verb `which` failed     at C:\Users\admin\ngx-admin\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 "python". checking python launcher
    npm ERR! gyp verb could not find "python". guessing location
    npm ERR! gyp verb ensuring that file exists: C:\Python27\python.exe
    npm ERR! gyp ERR! configure error 
    npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
    npm ERR! gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\admin\ngx-admin\node_modules\node-gyp\lib\configure.js:484:19)
    npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\admin\ngx-admin\node_modules\node-gyp\lib\configure.js:509:16)
    npm ERR! gyp ERR! stack     at C:\Users\admin\ngx-admin\node_modules\graceful-fs\polyfills.js:284:29
    npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:198:21)
    npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\admin\ngx-admin\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\admin\ngx-admin\node_modules\node-sass
    npm ERR! gyp ERR! node -v v16.14.0
    npm 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\admin\AppData\Local\npm-cache\_logs22-03-21T06_59_03_785Z-debug-0.log

要修复 node-sass 问题,请在项目根目录的 package.json 文件中将 "node-sass": "xx.xx.x" 更改为 "sass": "^1.49.0"。然后 运行 npm i 安装新包。

Though node-sass may be not the only issue with ngx-admin to make it run nowadays.