首页 > 解决方案 > 开始 ng new blabla 时出现错误

问题描述

当我尝试执行“ng new angular-realtime-polling”时出现以下错误:

gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (U:\angular-realtime-polling\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (U:\angular-realtime-polling\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (U:\angular-realtime-polling\node_modules\which\which.js:80:29)
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\which\which.js:89:16
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (U:\angular-realtime-polling\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (U:\angular-realtime-polling\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (U:\angular-realtime-polling\node_modules\which\which.js:80:29)
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\which\which.js:89:16
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python2\n    at getNotFoundError (U:\\angular-realtime-polling\\node_modules\\which\\which.js:13:12)\n    at F (U:\\angular-realtime-polling\\node_modules\\which\\which.js:68:19)\n    at E (U:\\angular-realtime-polling\\node_modules\\which\\which.js:80:29)\n    at U:\\angular-realtime-polling\\node_modules\\which\\which.js:89:16\n    at U:\\angular-realtime-polling\\node_modules\\isexe\\index.js:42:5\n    at U:\\angular-realtime-polling\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:153:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (U:\angular-realtime-polling\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (U:\angular-realtime-polling\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (U:\angular-realtime-polling\node_modules\which\which.js:80:29)
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\which\which.js:89:16
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed  python { Error: not found: python
gyp verb `which` failed     at getNotFoundError (U:\angular-realtime-polling\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (U:\angular-realtime-polling\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (U:\angular-realtime-polling\node_modules\which\which.js:80:29)
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\which\which.js:89:16
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at U:\angular-realtime-polling\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python\n    at getNotFoundError (U:\\angular-realtime-polling\\node_modules\\which\\which.js:13:12)\n    at F (U:\\angular-realtime-polling\\node_modules\\which\\which.js:68:19)\n    at E (U:\\angular-realtime-polling\\node_modules\\which\\which.js:80:29)\n    at U:\\angular-realtime-polling\\node_modules\\which\\which.js:89:16\n    at U:\\angular-realtime-polling\\node_modules\\isexe\\index.js:42:5\n    at U:\\angular-realtime-polling\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:153:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (U:\angular-realtime-polling\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (U:\angular-realtime-polling\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at U:\angular-realtime-polling\node_modules\graceful-fs\polyfills.js:282:31
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "U:\\angular-realtime-polling\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd U:\angular-realtime-polling\node_modules\node-sass
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN rollback Rolling back readable-stream@2.3.6 failed (this is probably harmless): EPERM: operation not permitted, lstat 'U:\angular-realtime-polling\node_modules\fsevents\node_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.11.0 (node_modules\node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.11.0 postinstall: `node scripts/build.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

添加了来自 1014 个贡献者的 1013 个包,并在 1412.486 秒内审核了 42608 个包,发现 0 个漏洞 Der Befehl "git" ist entweder falsch geschrieben oder konnte nicht gefunden werden。

有人知道我为什么会收到此错误以及如何解决吗?因为我没有头绪。非常感谢 !

标签: pythonangularnpm

解决方案


您需要安装 python 并设置错误中提到的环境变量才能解决此问题。

这个问题回答了如何为 windows 设置环境变量。

访问此链接以获取您需要的 python 版本。在 Windows 中,python 安装程序会要求您自动添加环境变量。


推荐阅读