当前位置: 首页 > news >正文

深圳网站制作公司兴田德润信任高推广赚钱平台

深圳网站制作公司兴田德润信任高,推广赚钱平台,响应式网站原理,织梦cms官网模板问题背景 内网环境中使用 node 构建项目,项目中依赖了 node-sass,环境自动下载 node-saas 失败(内网)。 下面是构建 node-sass 的错误代码: [5/5] Building fresh packages... error /workspace/node_modules/node-…

问题背景

内网环境中使用 node 构建项目,项目中依赖了 node-sass,环境自动下载 node-saas 失败(内网)。

下面是构建 node-sass 的错误代码:

[5/5] Building fresh packages...
error /workspace/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /workspace/node_modules/node-sass
Output:
Building: /usr/local/bin/node /workspace/node_modules/node-gyp/bin/node-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   '/usr/local/bin/node',
gyp verb cli   '/workspace/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@7.1.2
gyp info using node@16.18.1 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - executable path is "/usr/bin/python3"
gyp verb find Python - executing "/usr/bin/python3" to get version
gyp verb find Python - version is "3.7.3"
gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
gyp verb get node dir no --target version specified, falling back to host node version: 16.18.1
gyp verb command install [ '16.18.1' ]
gyp verb install input version string "16.18.1"
gyp verb install installing version: 16.18.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 16.18.1
gyp verb ensuring nodedir is created /root/.cache/node-gyp/16.18.1
gyp verb created nodedir /root/.cache
gyp http GET https://nodejs.org/download/release/v16.18.1/node-v16.18.1-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp verb command remove [ '16.18.1' ]
gyp verb remove using node-gyp dir: /root/.cache/node-gyp
gyp verb remove removing target version: 16.18.1
gyp verb remove removing development files for version: 16.18.1
gyp ERR! configure error 
gyp ERR! stack Error: connect ETIMEDOUT 104.20.22.46:443
gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
gyp ERR! System Linux 3.10.0-1160.6.1.el7.x86_64
gyp ERR! command "/usr/local/bin/node" "/workspace/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /workspace/node_modules/node-sass
gyp ERR! node -v v16.18.1
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok 
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[Pipeline] }

引发错误的主要原因是 没能正常下载和安装 node-sass 而导致的上述相关异常。


下文介绍如何使用 nexus 配置 raw 类型的仓库,通过代理来解决这个问题,方案有两种:

1、在 nexus 中创建 raw proxy 类型的仓库,配置对应的代理地址,通过 nexus 访问目标文件使其缓存到 nexus 中,然后提供给将 nexus 的地址提供给其他不能连接外网的环境使用(这种方法需要 nexus 有机会连接外网)。
2、在 nexus 中创建 raw hosted 类型的仓库,手工上传对应的目标文件包,同理第1点再将 nexus 的对应地址提供给不能连接外网的主机使用。

下文使用第1种方法演示。

nexus raw 仓库介绍

raw 可以理解为普通类型的文件存储,就相对于一块存储,可以往里面传入任何的文件包。

配置和使用方法

下面就不做文字赘述了,贴上所有的截图,相关说明都写在截图上了。

在 nexus 中创建仓库

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

最后我们测试验证一下,以 node-sass 为例,其对应的淘宝镜像的访问地址为 https://npm.taobao.org/mirrors/node-sass/

使用浏览器访问 https://npm.taobao.org/mirrors/node-sass/v5.0.0/win32-x64-72_binding.node 确认可以成功下载文件。

然后再替换 URL 前面一段内容,访问 http://nexus.yourdomain.com/repository/raw-public/node-sass/v5.0.0/win32-x64-72_binding.node 进行下载,正常也是可以下载相同文件的,这就表示成功了,下载文件后再进入 nexus 的 raw-public 仓库下,就能看到刚刚下载并缓存的文件了。

在这里插入图片描述

以 node-sass 为例使用仓库地址

1、方式一,全局配置

# 带 -g 为全局
# npm 配置使用
npm config set sass_binary_site http://nexus.yourdomain.com/repository/raw-public/node-sass/ -g# yarn 配置使用
yarn config set sass_binary_site http://nexus.yourdomain.com/repository/raw-public/node-sass -g

如果是仅安装具体包时通过命令指定,可以这样:
npm i node-sass --sass_binary_site=http://nexus.yourdomain.com/repository/raw-public/node-sass/

2、方式二,单项目配置

在项目工程代码根目录(与 package.json 放一起)创建 .npmrc 文件(对应 npm)或者 .yarnrc 文件(对应 yarn),内容分别如下所示:

.npmrc 文件(npm 使用)

registry=https://registry.npm.taobao.org
sass_binary_site=http://nexus.yourdomain.com/repository/raw-public/node-sass/

.yarnrc 文件(yarn 使用)

registry "https://registry.npm.taobao.org"
sass_binary_site "http://nexus.yourdomain.com/repository/raw-public/node-sass"

进行以上配置后,通过 npm 或 yarn 命令构建项目即可使用。


最后再补充一个与本文 nexus 无关但是与 node-sass 离线使用有关的,就是与 sass_binary_site 对应的另外一个配置参数 sass_binary_path,顾名思义前者 _site 后缀是站点,后者 _path 后缀就是本地路径的意思了,如下为 yarn 的设置示例:

# 二进制文件官网下载地址为 https://github.com/sass/node-sass/releases
yarn config set sass_binary_path /opt/soft/node/node-sass/v6.0.1/linux-x64-93_binding.node -g

npm 及项目配置文件方式同上。


(END)

http://www.lbrq.cn/news/2729881.html

相关文章:

  • 龙港哪里有做阿里巴巴网站百度贴吧官网首页
  • 滨州做网站的公司seo优化的主要任务包括
  • 对网站做数据统计的目的是什么什么是seo教程
  • 上哪个网站做forma和co写软文能赚钱吗
  • 网站比较分析搭建个人网站
  • wordpress模板layuiseo应该如何做
  • 电信宽带营销策划方案厦门网站流量优化价格
  • 专业拓客公司联系方式windows优化大师有用吗
  • 餐饮行业网站建设友情链接还有用吗
  • 企业网站管理系统的设计与实现石家庄seo外包的公司
  • 如何做建材团购网站网盘资源共享群吧
  • 公章电子版在线制作网站百度客服中心
  • 中山做网站排名推广文章
  • 建网站 西安交换友情链接平台
  • 怎么做响应式网站网站推广营销运营方式
  • 一朋友做色情网站被抓了可以直接进入网站的正能量
  • 电子政务政府门户网站建设怎么创建公司网站
  • 乐清外贸网站建设b2b平台排名
  • 如何快速创建一个网站百度首页排名代发
  • 音乐外链生成网站怎么做搜索引擎优化工作
  • 建立网站需要什么手续软文推广页面
  • 义乌做网站公司东莞关键词排名seo
  • 网站开发远程服务器如何设置软件开发公司联系方式
  • 网站主体负责人不是法人什么是关键词举例说明
  • 南昌做网站装修的企业刷推广链接
  • 做网站美工未来规划哪里做网站便宜
  • 网站开发代理商廊坊网站
  • 西宁市网站建设高端在线葡京在线葡京
  • wordpress 飘窗郑州网站seo推广
  • 太原网站建设信息推荐网络科技公司经营范围
  • 守护品质安全,防伪溯源系统打造全链路信任体系
  • C语言笔记6:C高级 part1
  • 20250815在荣品RD-RK3588-MID开发板的Android13下调通TP芯片FT8206
  • 基于机器学习的文本情感极性分析系统设计与实现
  • 能源行业数字化转型:边缘计算网关在油田场景的深度应用
  • javaswing json格式化工具