我在Windows 7上使用VS 2017和.NET Core 2。 尝试按照这些说明创建一个新的.NET Core 2.0和Angular应用程序。
运行最新版本的node和npm:
node -v > v10.1.0
npm -v > v6.0.1
根据指示,我开始构建应用程序,但出现了“找不到Python”的错误。我检查了环境变量,路径中有Python。不确定为什么找不到。
构建似乎“半成品”,已经解决了一些依赖项。第二次尝试构建应用程序时,出现了JavaScript运行时错误...我认为这是由于第一次糟糕的构建任务导致的。
我还尝试在ClientApp文件夹中运行“npm install”,但出现了相同的错误“找不到Python”。
如果能得到任何帮助将不胜感激!
构建日志:
1>------ Build started: Project: TestApp, Configuration: Debug Any CPU ------
1>TestApp -> C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\bin\Debug\netcoreapp2.0\TestApp.dll
1>v10.1.0
1>Restoring dependencies using 'npm'. This may take several minutes...
1>
1>> uws@9.14.0 install C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\uws
1>> node-gyp rebuild > build_log.txt 2>&1 || exit 0
1>
1>
1>> node-sass@4.7.2 install C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\node-sass
1>> node scripts/install.js
1>
1>Downloading binary from https://github.com/sass/node-sass/releases/download/v4.7.2/win32-x64-64_binding.node
1>Cannot download "https://github.com/sass/node-sass/releases/download/v4.7.2/win32-x64-64_binding.node":
1>
1>HTTP error 404 Not Found
1>
1>Hint: If github.com is not accessible in your location
1> try setting a proxy via HTTP_PROXY, e.g.
1>
1> export HTTP_PROXY=http://example.com:1234
1>
1>or configure npm proxy via
1>
1> npm config set proxy http://example.com:8080
1>
1>> uglifyjs-webpack-plugin@0.4.6 postinstall C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
1>> node lib/post_install.js
1>
1>
1>> node-sass@4.7.2 postinstall C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\node-sass
1>> node scripts/build.js
1>
1>Building: C:\Program Files\nodejs\node.exe C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
1>gyp info it worked if it ends with ok
1>gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
1>gyp verb cli 'C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\node-gyp\\bin\\node-gyp.js',
1>gyp verb cli 'rebuild',
1>gyp verb cli '--verbose',
1>gyp verb cli '--libsass_ext=',
1>gyp verb cli '--libsass_cflags=',
1>gyp verb cli '--libsass_ldflags=',
1>gyp verb cli '--libsass_library=' ]
1>gyp info using node-gyp@3.6.2
1>gyp info using node@10.1.0 | win32 | x64
1>gyp verb command rebuild []
1>gyp verb command clean []
1>gyp verb clean removing "build" directory
1>gyp verb command configure []
开始出现故障...
1>gyp verb check python checking for Python executable "python2" in the PATH
1>EXEC : gyp verb `which` failed error : not found: python2
1>gyp verb `which` failed at getNotFoundError (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:13:12)
1>gyp verb `which` failed at F (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:68:19)
1>gyp verb `which` failed at E (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:80:29)
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:89:16
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\isexe\index.js:42:5
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\isexe\windows.js:36:5
1>gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:165:21)
1>EXEC : gyp verb `which` failed python2 { error : not found: python2
1>gyp verb `which` failed at getNotFoundError (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:13:12)
1>gyp verb `which` failed at F (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:68:19)
1>gyp verb `which` failed at E (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:80:29)
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:89:16
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\isexe\index.js:42:5
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\isexe\windows.js:36:5
1>gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:165:21)
1>gyp verb `which` failed stack: 'Error: not found: python2\n at getNotFoundError (C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\which\\which.js:13:12)\n at F (C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\which\\which.js:68:19)\n at E (C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\which\\which.js:80:29)\n at C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\which\\which.js:89:16\n at C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\isexe\\index.js:42:5\n at C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\isexe\\windows.js:36:5\n at FSReqWrap.oncomplete (fs.js:165:21)',
1>gyp verb `which` failed code: 'ENOENT' }
1>gyp verb check python checking for Python executable "python" in the PATH
1>EXEC : gyp verb `which` failed error : not found: python
1>gyp verb `which` failed at getNotFoundError (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:13:12)
1>gyp verb `which` failed at F (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:68:19)
1>gyp verb `which` failed at E (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:80:29)
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:89:16
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\isexe\index.js:42:5
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\isexe\windows.js:36:5
1>gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:165:21)
1>EXEC : gyp verb `which` failed python { error : not found: python
1>gyp verb `which` failed at getNotFoundError (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:13:12)
1>gyp verb `which` failed at F (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:68:19)
1>gyp verb `which` failed at E (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:80:29)
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\which\which.js:89:16
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\isexe\index.js:42:5
1>gyp verb `which` failed at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\isexe\windows.js:36:5
1>gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:165:21)
1>gyp verb `which` failed stack: 'Error: not found: python\n at getNotFoundError (C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\which\\which.js:13:12)\n at F (C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\which\\which.js:68:19)\n at E (C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\which\\which.js:80:29)\n at C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\which\\which.js:89:16\n at C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\isexe\\index.js:42:5\n at C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\isexe\\windows.js:36:5\n at FSReqWrap.oncomplete (fs.js:165:21)',
1>gyp verb `which` failed code: 'ENOENT' }
1>gyp verb could not find "python". checking python launcher
1>gyp verb could not find "python". guessing location
1>gyp verb ensuring that file exists: C:\Python27\python.exe
1>gyp ERR! configure error
1>EXEC : gyp ERR! stack error : Can't find Python executable "python", you can set the PYTHON env variable.
1>gyp ERR! stack at PythonFinder.failNoPython (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\node-gyp\lib\configure.js:483:19)
1>gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\node-gyp\lib\configure.js:508:16)
1>gyp ERR! stack at C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\graceful-fs\polyfills.js:284:29
1>gyp ERR! stack at FSReqWrap.oncomplete (fs.js:165:21)
1>gyp ERR! System Windows_NT 6.1.7601
1>gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mohammadrauf\\Desktop\\Angular_Projects\\TestApp\\ClientApp\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
1>gyp ERR! cwd C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\node-sass
1>gyp ERR! node -v v10.1.0
1>gyp ERR! node-gyp -v v3.6.2
1>gyp ERR! not ok
1>EXEC : Build failed with error code: 1
1>npm WARN rollback Rolling back y18n@3.2.1 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\mohammadrauf\Desktop\Angular_Projects\TestApp\ClientApp\node_modules\yargs\node_modules'
1>npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.7.2 (node_modules\node-sass):
1>npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.7.2 postinstall: `node scripts/build.js`
1>npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
1>
1>added 1218 packages from 1231 contributors in 93.516s
1>[!] 33 vulnerabilities found [6676 packages audited]
1> Severity: 3 Low | 21 Moderate | 9 High
1> Run `npm audit` for more detail