vue中的一些小异常

1、node-sass 安装失败的原因及解决办法

  npm install 时偶尔遇到报错:没有安装python或node-sass 安装失败的问题,在百度上找了很多的方法,但是执行之后,都没有什么效果,最后发现原来是因为没有卸载之前安装失败的包导致的。解决方案是npm uninstall node-sass,然后使用VPN重新安装了一遍就成功了。

  node-sass 安装失败的原因:npm 安装 node-sass 依赖时,会从 github.com 上下载 .node 文件。由于国内网络环境的问题,这个下载时间可能会很长,甚至导致超时失败。这是使用 sass 可能都会遇到的郁闷的问题。解决方案就是使用其他源,或者使用工具下载,然后将安装源指定到本地。

  解决方法一:使用淘宝镜像源(推荐);设置变量 sass_binary_site,指向淘宝镜像地址。示例:

1 npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
2 
3 // 也可以设置系统环境变量的方式。示例
4 // linux、mac 下
5 SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass
6 
7 // window 下
8 set SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ && npm install node-sass

  或者设置全局镜像源:

1 npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/

  之后再涉及到 node-sass 的安装时就会从淘宝镜像下载。

  解决方法二:使用 cnpm;使用 cnpm 安装 node-sass 会默认从淘宝镜像源下载,也是一个办法:

1 cnpm install node-sass

  解决方法三:创建.npmrc文件;在项目根目录创建.npmrc文件,复制下面代码到该文件。

1 phantomjs_cdnurl=http://cnpmjs.org/downloads
2 sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
3 registry=https://registry.npm.taobao.org

  保存后 删除之前安装失败的包(第一次安装请跳过此步)

1 npm uninstall node-sass

  重新安装

1 npm install node-sass

  后来另一个项目在没有使用VPN的情况下测试此方法,安装时报错 ERR! node-sass@3.8.0 postinstall: `node scripts/build.js 改用方法一成功。

  解决方法四:下载 .node 到本地;这里去根据版本号、系统环境,选择下载 .node 文件,然后安装时,指定变量 sass_binary_path,如:

1 npm i node-sass --sass_binary_path=/Users/lzwme/Downloads/darwin-x64-48_binding.node

  安装失败后重新安装问题

  之前安装失败,再安装就不去下载了,怎么办呢?那就先卸载再安装:

1 安装失败后重新安装问题
2 之前安装失败,再安装就不去下载了,怎么办呢?那就先卸载再安装:
  1 $ npm install
  2 
  3 > node-sass@4.7.2 install D:workspacegongsiwdf-wxreport
ode_modules
ode-sass
  4 > node scripts/install.js
  5 
  6 Downloading binary from https://npm.taobao.org/mirrors/node-sass//v4.7.2/win32-x64-83_binding.node
  7 Cannot download "https://npm.taobao.org/mirrors/node-sass//v4.7.2/win32-x64-83_binding.node":
  8 
  9 HTTP error 404 Not Found
 10 
 11 Hint: If github.com is not accessible in your location
 12       try setting a proxy via HTTP_PROXY, e.g.
 13 
 14       export HTTP_PROXY=http://example.com:1234
 15 
 16 or configure npm proxy via
 17 
 18       npm config set proxy http://example.com:8080
 19 
 20 > node-sass@4.7.2 postinstall D:workspacegongsiwdf-wxreport
ode_modules
ode-sass
 21 > node scripts/build.js
 22 
 23 Building: D:wenjiananzhuang
ode
ode.exe D:workspacegongsiwdf-wxreport
ode_modules
ode-gypin
ode-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsas
 24 s_library=
 25 gyp info it worked if it ends with ok
 26 gyp verb cli [
 27 gyp verb cli   'D:\wenjiananzhuang\node\node.exe',
 28 gyp verb cli   'D:\workspace\gongsi\wdf-wxreport\node_modules\node-gyp\bin\node-gyp.js',
 29 gyp verb cli   'rebuild',
 30 gyp verb cli   '--verbose',
 31 gyp verb cli   '--libsass_ext=',
 32 gyp verb cli   '--libsass_cflags=',
 33 gyp verb cli   '--libsass_ldflags=',
 34 gyp verb cli   '--libsass_library='
 35 gyp verb cli ]
 36 gyp info using node-gyp@3.6.2
 37 gyp info using node@14.15.1 | win32 | x64
 38 gyp verb command rebuild []
 39 gyp verb command clean []
 40 gyp verb clean removing "build" directory
 41 gyp verb command configure []
 42 gyp verb check python checking for Python executable "python2" in the PATH
 43 gyp verb `which` failed Error: not found: python2
 44 gyp verb `which` failed     at getNotFoundError (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:13:12)
 45 gyp verb `which` failed     at F (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:68:19)
 46 gyp verb `which` failed     at E (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:80:29)
 47 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:89:16
 48 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_modulesisexeindex.js:42:5
 49 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_modulesisexewindows.js:36:5
 50 gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:183:21)
 51 gyp verb `which` failed  python2 Error: not found: python2
 52 gyp verb `which` failed     at getNotFoundError (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:13:12)
 53 gyp verb `which` failed     at F (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:68:19)
 54 gyp verb `which` failed     at E (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:80:29)
 55 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:89:16
 56 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_modulesisexeindex.js:42:5
 57 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_modulesisexewindows.js:36:5
 58 gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:183:21) {
 59 gyp verb `which` failed   code: 'ENOENT'
 60 gyp verb `which` failed }
 61 gyp verb check python checking for Python executable "python" in the PATH
 62 gyp verb `which` failed Error: not found: python
 63 gyp verb `which` failed     at getNotFoundError (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:13:12)
 64 gyp verb `which` failed     at F (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:68:19)
 65 gyp verb `which` failed     at E (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:80:29)
 66 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:89:16
 67 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_modulesisexeindex.js:42:5
 68 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_modulesisexewindows.js:36:5
 69 gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:183:21)
 70 gyp verb `which` failed  python Error: not found: python
 71 gyp verb `which` failed     at getNotFoundError (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:13:12)
 72 gyp verb `which` failed     at F (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:68:19)
 73 gyp verb `which` failed     at E (D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:80:29)
 74 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_moduleswhichwhich.js:89:16
 75 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_modulesisexeindex.js:42:5
 76 gyp verb `which` failed     at D:workspacegongsiwdf-wxreport
ode_modulesisexewindows.js:36:5
 77 gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:183:21) {
 78 gyp verb `which` failed   code: 'ENOENT'
 79 gyp verb `which` failed }
 80 gyp verb could not find "python". checking python launcher
 81 gyp verb could not find "python". guessing location
 82 gyp verb ensuring that file exists: C:Python27python.exe
 83 gyp ERR! configure error
 84 gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
 85 gyp ERR! stack     at PythonFinder.failNoPython (D:workspacegongsiwdf-wxreport
ode_modules
ode-gyplibconfigure.js:483:19)
 86 gyp ERR! stack     at PythonFinder.<anonymous> (D:workspacegongsiwdf-wxreport
ode_modules
ode-gyplibconfigure.js:508:16)
 87 gyp ERR! stack     at D:workspacegongsiwdf-wxreport
ode_modulesgraceful-fspolyfills.js:284:29
 88 gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:183:21)
 89 gyp ERR! System Windows_NT 10.0.18363
 90 gyp ERR! command "D:\wenjiananzhuang\node\node.exe" "D:\workspace\gongsi\wdf-wxreport\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=
 91 " "--libsass_ldflags=" "--libsass_library="
 92 gyp ERR! cwd D:workspacegongsiwdf-wxreport
ode_modules
ode-sass
 93 gyp ERR! node -v v14.15.1
 94 gyp ERR! node-gyp -v v3.6.2
 95 gyp ERR! not ok
 96 Build failed with error code: 1
 97 npm WARN rollback Rolling back ajv@4.11.8 failed (this is probably harmless): EPERM: operation not permitted, lstat 'D:workspacegongsiwdf-wxreport
ode_modulesfsevents
ode_modules'
 98 npm WARN rollback Rolling back tar-pack@3.4.0 failed (this is probably harmless): EPERM: operation not permitted, lstat 'D:workspacegongsiwdf-wxreport
ode_modulesfsevents
ode_modules'
 99 npm WARN wd-vue-stat@0.0.1 No repository field.
100 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modulesfsevents):
101 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
102 
103 npm ERR! code ELIFECYCLE
104 npm ERR! errno 1
105 npm ERR! node-sass@4.7.2 postinstall: `node scripts/build.js`
106 npm ERR! Exit status 1
107 npm ERR!
108 npm ERR! Failed at the node-sass@4.7.2 postinstall script.
109 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
110 
111 npm ERR! A complete log of this run can be found in:
112 npm ERR!     D:wenjiananzhuang
ode
ode_cache\_logs2020-12-14T05_46_09_374Z-debug.log

     在这里,我选择的是方法,先删除已有的包(npm uninstall node-sass),在设置相关的镜像(npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/);在执行npm install 就可以了

  

 

kafka rabbitMq
原文地址:https://www.cnblogs.com/stt101517/p/14133082.html