全局安装依赖的时候,因为node-sass报错
Module build failed (from .[表情]de_modules/mini-css-extract-plugin/dist/loader.js): ModuleBuildError: Module build failed (from .[表情]de_modules[表情]ss-loader[表情]b/loader.js): Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (72) For more information on which environments are supported please see: https://github.com/sass/node-sass/releases/tag/v4.11.0 at module.exports (E:Gitpmdm-web ode_modules\_node-sass@4.11.0@node-sasslibinding.js:13:13) at Object.<anonymous> (E:Gitpmdm-web ode_modules\_node-sass@4.11.0@node-sasslibindex.js:14:35) at Module._compile (internal/modules[表情]s/loader.js:1158:30) at Object.Module._extensions..js (internal/modules[表情]s/loader.js:1178:10) at Module.load (internal/modules[表情]s/loader.js:1002:32) at Function.Module._load (internal/modules[表情]s/loader.js:901:14) at Module.require (internal/modules[表情]s/loader.js:1044:19) at require (internal/modules[表情]s/helpers.js:77:18) at Object.sassLoader (E:Gitpmdm-web ode_modulessass-loaderlibloader.js:46:72) at E:Gitpmdm-web ode_moduleswebpacklibNormalModule.js:301:20 at E:Gitpmdm-web ode_modulesloader-runnerlibLoaderRunner.js:367:11 at E:Gitpmdm-web ode_modulesloader-runnerlibLoaderRunner.js:233:18 at runSyncOrAsync (E:Gitpmdm-web ode_modulesloader-runnerlibLoaderRunner.js:143:3) at iterateNormalLoaders (E:Gitpmdm-web ode_modulesloader-runnerlibLoaderRunner.js:232:2) at E:Gitpmdm-web ode_modulesloader-runnerlibLoaderRunner.js:186:6 at context.callback (E:Gitpmdm-web ode_modulesloader-runnerlibLoaderRunner.js:111:13) at E:Gitpmdm-web ode_modulescache-loaderdistindex.js:171:7 at E:Gitpmdm-web ode_modules eo-asyncasync.js:2830:7 at done (E:Gitpmdm-web ode_modules eo-asyncasync.js:2865:11) at E:Gitpmdm-web ode_modules eo-asyncasync.js:2818:7 at E:Gitpmdm-web ode_modulescache-loaderdistindex.js:160:9 at E:Gitpmdm-web ode_modulesenhanced-resolvelibCachedInputFileSystem.js:85:15 at processTicksAndRejections (internal/process/task_queues.js:79:11)
尝试了先卸载node-sass
npm uninstall node-sass
再安装
npm i node-sass
还是报错,这次貌似跟Python相关但是不用管它
ode-sass@4.13.1 install E:Gitpmdm-web ode_modules ode-sass > node scripts/install.js Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.1/win32-x64-72_binding.node Cannot download "https://github.com/sass/node-sass/releases/download/v4.13.1/win32-x64-72_binding.node": ESOCKETTIMEDOUT Hint: If github.com is not accessible in your location try setting a proxy via HTTP_PROXY, e.g. export HTTP_PROXY=http://example.com:1234 or configure npm proxy via npm config set proxy http://example.com:8080 > node-sass@4.13.1 postinstall E:Gitpmdm-web ode_modules ode-sass > node scripts[表情]ild.js Building: D: ode.exe E:Gitpmdm-web ode_modules ode-gypin ode-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli 'D:\node.exe', gyp verb cli 'E:\Git\pmdm-web\node_modules\node-gyp\bin\node-gyp.js', gyp verb cli 'rebuild', gyp verb cli '--verbose', gyp verb cli '--libsass_ext=', gyp verb cli '--libsass_cflags=', gyp verb cli '--libsass_ldflags=', gyp verb cli '--libsass_library=' gyp verb cli ] gyp info using node-gyp@3.8.0 gyp info using node@12.16.1 | win32 | x64 gyp verb command rebuild [] gyp verb command clean [] 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 (E:Gitpmdm-web ode_moduleswhichwhich.js:13:12) gyp verb `which` failed at F (E:Gitpmdm-web ode_moduleswhichwhich.js:68:19) gyp verb `which` failed at E (E:Gitpmdm-web ode_moduleswhichwhich.js:80:29) gyp verb `which` failed at E:Gitpmdm-web ode_moduleswhichwhich.js:89:16 gyp verb `which` failed at E:Gitpmdm-web ode_modulesisexeindex.js:42:5 gyp verb `which` failed at E:Gitpmdm-web ode_modulesisexewindows.js:36:5 gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:166:21) gyp verb `which` failed python2 Error: not found: python2 gyp verb `which` failed at getNotFoundError (E:Gitpmdm-web ode_moduleswhichwhich.js:13:12) gyp verb `which` failed at F (E:Gitpmdm-web ode_moduleswhichwhich.js:68:19) gyp verb `which` failed at E (E:Gitpmdm-web ode_moduleswhichwhich.js:80:29) gyp verb `which` failed at E:Gitpmdm-web ode_moduleswhichwhich.js:89:16 gyp verb `which` failed at E:Gitpmdm-web ode_modulesisexeindex.js:42:5 gyp verb `which` failed at E:Gitpmdm-web ode_modulesisexewindows.js:36:5 gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:166:21) { gyp verb `which` failed stack: 'Error: not found: python2 ' + gyp verb `which` failed ' at getNotFoundError (E:\Git\pmdm-web\node_modules\which\which.js:13:12) ' + gyp verb `which` failed ' at F (E:\Git\pmdm-web\node_modules\which\which.js:68:19) ' + gyp verb `which` failed ' at E (E:\Git\pmdm-web\node_modules\which\which.js:80:29) ' + gyp verb `which` failed ' at E:\Git\pmdm-web\node_modules\which\which.js:89:16 ' + gyp verb `which` failed ' at E:\Git\pmdm-web\node_modules\isexe\index.js:42:5 ' + gyp verb `which` failed ' at E:\Git\pmdm-web\node_modules\isexe\windows.js:36:5 ' + gyp verb `which` failed ' at FSReqCallback.oncomplete (fs.js:166:21)', gyp verb `which` failed code: 'ENOENT' gyp verb `which` failed } checking for Python executable "python" in the PATH gyp verb `which` failed Error: not found: python gyp verb `which` failed at getNotFoundError (E:Gitpmdm-web ode_moduleswhichwhich.js:13:12) gyp verb `which` failed at F (E:Gitpmdm-web ode_moduleswhichwhich.js:68:19) gyp verb `which` failed at E (E:Gitpmdm-web ode_moduleswhichwhich.js:80:29) gyp verb `which` failed at E:Gitpmdm-web ode_moduleswhichwhich.js:89:16 gyp verb `which` failed at E:Gitpmdm-web ode_modulesisexeindex.js:42:5 gyp verb `which` failed at E:Gitpmdm-web ode_modulesisexewindows.js:36:5 gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:166:21) gyp verb `which` failed python Error: not found: python gyp verb `which` failed at getNotFoundError (E:Gitpmdm-web ode_moduleswhichwhich.js:13:12) gyp verb `which` failed at F (E:Gitpmdm-web ode_moduleswhichwhich.js:68:19) gyp verb `which` failed at E (E:Gitpmdm-web ode_moduleswhichwhich.js:80:29) gyp verb `which` failed at E:Gitpmdm-web ode_moduleswhichwhich.js:89:16 gyp verb `which` failed at E:Gitpmdm-web ode_modulesisexeindex.js:42:5 gyp verb `which` failed at E:Gitpmdm-web ode_modulesisexewindows.js:36:5 gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:166:21) { gyp verb `which` failed stack: 'Error: not found: python ' + gyp verb `which` failed ' at getNotFoundError (E:\Git\pmdm-web\node_modules\which\which.js:13:12) ' + gyp verb `which` failed ' at F (E:\Git\pmdm-web\node_modules\which\which.js:68:19) ' + gyp verb `which` failed ' at E (E:\Git\pmdm-web\node_modules\which\which.js:80:29) ' + gyp verb `which` failed ' at E:\Git\pmdm-web\node_modules\which\which.js:89:16 ' + gyp verb `which` failed ' at E:\Git\pmdm-web\node_modules\isexe\index.js:42:5 ' + gyp verb `which` failed ' at E:\Git\pmdm-web\node_modules\isexe\windows.js:36:5 ' + gyp verb `which` failed ' at FSReqCallback.oncomplete (fs.js:166:21)', gyp verb `which` failed code: 'ENOENT' gyp verb `which` failed } gyp verb could not find "python". checking python launcher gyp verb ensuring that file exists: C:Python27python.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 (E:Gitpmdm-web ode_modules ode-gyplibconfigure.js:484:19) gyp ERR! stack at callback (E:Gitpmdm-web ode_modules ode-gyp ode_modulesgraceful-fspolyfills.js:295:20) gyp ERR! stack at FSReqCallback.oncomplete (fs.js:166:21) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "D:\node.exe" "E:\Git\pmdm-web\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd E:Gitpmdm-web ode_modules ode-sass gyp ERR! node -v v12.16.1 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok Build failed with error code: 1 npm WARN extract-text-webpack-plugin@3.0.2 requires a peer of webpack@^3.1.0 but none is installed. You must install peer dependencies yourself. npm WARN uglifyjs-webpack-plugin@0.4.6 requires a peer of webpack@^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modulesfsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.13.1 postinstall: `node scripts[表情]ild.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@4.13.1 postinstall 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! C:UsersmovitAppDataRoaming pm-cache\_logs2020-03-16T13_32_04_414Z-debug.log
使用下面的方法 这次终于成功了
npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass