编译脚本部分内容: ember_assets=${project_root}/public/assets ember_resources_dir=${ember_assets}/ember ember_web_directory=${project_root}/web # cd to the ember directory cd ${ember_web_directory} npm install node_modules/bower/bin/bower install node_modules/ember-cli/bin/ember build --prod rm -r ${ember_resources_dir} 2> /dev/null mkdir ${ember_resources_dir} cp dist/assets/dr-elephant.css ${ember_resources_dir}/ cp dist/assets/dr-elephant.js ${ember_resources_dir}/ cp dist/assets/vendor.js ${ember_resources_dir}/ cp dist/assets/vendor.css ${ember_resources_dir}/ cp -r dist/fonts ${ember_assets}/ cd ${project_root}
降级node.js到7.10.1
-
running
npm install -g windows-build-tools
from an elevated PowerShell (run as Administrator).
GitHub - felixrieseberg/windows-build-tools: :package: Install C++ Build Tools for Windows using npm
完成后 控制面板\程序\程序和功能会多出以下程序
C:\Users\youname\.windows-build-tools\vs_BuildTools.exe
bower配置代理上网 参考:Configuration · Bower
{
"directory": "bower_components",
"proxy": "http://127.0.0.1:10809",
"https-proxy": "http://127.0.0.1:10809"
}
bower d3#4.2.6 CERT_HAS_EXPIRED Request to https://registry.bower.io/packages/d3 failed: certificate has expired
方法 2: 使用 HTTP 替代 HTTPS
bower install d3#4.2.6 --force
离线安装 node-sass win32-x64-51_binding.node
这些文件看起来是 node-sass
的预编译二进制文件 (binding.node
和 binding.pdb
) 对应不同的 Node.js 版本。在特定情况下,你可能需要手动安装这些二进制文件,以避免每次安装 node-sass
时都重新编译。以下是如何使用这些文件的详细步骤:
步骤 1:确定你的 Node.js 版本
首先,你需要确定你正在使用的 Node.js 版本。可以通过以下命令检查:
node -v
例如,如果你得到的版本是 v14.x.x
,那么你需要使用 win32-x64-83_binding.node
和相应的 .pdb
文件(假设 83
对应 Node.js v14.x.x
,你可能需要根据实际情况查找正确的版本对照表)。
步骤 2:创建目录结构
在你的项目中,找到 node-sass
模块的安装位置。通常它会在 node_modules/node-sass
目录中。你需要在这个目录下创建 vendor
目录结构。
cd your_project_directory/node_modules/node-sass mkdir -p vendor/win32-x64-83
步骤 3:复制文件
将预编译的二进制文件(binding.node
和 binding.pdb
)复制到 vendor
目录中。
# 假设你已经下载并解压了这些文件到某个临时目录 cp /path/to/win32-x64-83_binding.node vendor/win32-x64-83/binding.node cp /path/to/win32-x64-83_binding.pdb vendor/win32-x64-83/binding.pdb
步骤 4:验证安装??
运行以下命令来验证 node-sass
是否可以正常工作:
npx node-sass --version
如果一切配置正确,你应该能看到 node-sass
的版本信息,并且不再需要重新编译。
如何确定 对应版本
ChatGPT
要确定 node-sass
预编译二进制文件 (binding.node
) 对应的 Node.js 版本,你可以查找 Node.js 的 ABI (Application Binary Interface) 版本。这些文件名中的数字通常表示 Node.js 的 ABI 版本。以下是一些常见的 Node.js 版本及其对应的 ABI 版本:
Node.js 版本 | ABI 版本 |
---|---|
0.10.x | 11 |
0.12.x | 14 |
4.x | 46 |
5.x | 47 |
6.x | 48 |
7.x | 51 |
8.x | 57 |
9.x | 59 |
10.x | 64 |
11.x | 67 |
12.x | 72 |
13.x | 79 |
14.x | 83 |
15.x | 88 |
16.x | 93 |
确定 Node.js 版本的 ABI 版本
你可以通过运行以下命令来确定你当前的 Node.js 版本的 ABI 版本:
node -p process.versions.modules
The Broccoli Plugin: [Funnel] failed with: Error: ENOENT: no such file or directory, symlink 'D:\code\dr-elephant\web\tmp\funnel-input_base_path-5g6vKIJ6.tmp\adnan-wahab\pathgl\named-amd\main.js' -> 'D:\code\dr-elephant\web\tmp\funnel-output_path-pte71sJi.tmp\d3-plugins-dist\adnan-wahab\pathgl\named-amd\main.js'
at Object.fs.symlinkSync (fs.js:1034:18)
https://github.com/broccolijs/broccoli-funnel/issues/60 Broccoli Plugin: [Funnel] failed
https://github.com/broccolijs/broccoli-funnel/issues/53
Broccoli Merge Tree failing on Windows OS · Issue #42 · broccolijs/broccoli-merge-trees · GitHub
最终定位原因:目标的多级父目录不存在
解决办法:逐级创建目录
symlink-or-copy/index.js
symlinkWindows
if (options.canSymlinkFile) { var isExists = options.fs.existsSync(path.dirname(destPath)); if (!isExists) { var parentDir = path.dirname(destPath); console.log("destPath " + destPath) console.log("parentDir " + parentDir) // var WINDOWS_PREFIX = "\\\\?\\"; const dirParts = parentDir.substring(4).split(path.sep); let currentPath = ''; for (let part of dirParts) { currentPath = path.join(currentPath, part); currentPath= currentPath.replace("D:code","D:\\code") try { if (!fs.existsSync(currentPath)) { fs.mkdirSync(currentPath); console.log(`Created directory: ${currentPath}`); } } catch (err) { console.error(`Error creating directory: ${currentPath}`); console.error(`Error message: ${err.message}`); break; } } /* options.fs.mkdirSync(parentDir.substring(4), {recursive: true}, (err) => { if (err) { console.error(`Error creating directory: ${err}`); } else { console.log('Directory created successfully'); } });*/ } options.fs.symlinkSync(srcPath, ((destPath)), 'file'); }