【问题标题】:NPM can't install node-sass on windows 10NPM 无法在 Windows 10 上安装 node-sass
【发布时间】:2020-01-03 12:41:54
【问题描述】:

在 Windows 10 上安装 node-sass(所有版本 4.9.0、4.12.0、4.13.0 等)时遇到问题。

NPM 版本 - v6.4.1
NODE 版本 - v10.15.3

问题:

3090 silly saveTree `-- node-sass@4.13.0
3091 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
3092 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
3093 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
3093 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
3093 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
3093 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
3094 verbose stack Error: node-sass@4.13.0 install: `node scripts/install.js`
3094 verbose stack spawn bash ENOENT
3094 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
3094 verbose stack     at onErrorNT (internal/child_process.js:415:16)
3094 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
3095 verbose pkgid node-sass@4.13.0
3096 verbose cwd C:\xampp\htdocs\web\wp-content\themes\web
3097 verbose Windows_NT 10.0.18362
3098 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-sass"
3099 verbose node v10.15.3
3100 verbose npm  v6.4.1
3101 error file bash
3102 error path bash
3103 error code ELIFECYCLE
3104 error errno ENOENT
3105 error syscall spawn bash
3106 error node-sass@4.13.0 install: `node scripts/install.js`
3106 error spawn bash ENOENT
3107 error Failed at the node-sass@4.13.0 install script.
3107 error This is probably not a problem with npm. There is likely additional logging output above.
3108 verbose exit [ 1, true ]

所有步骤都已完成: --force-g--unsafe-perm 等等,但没有任何效果。

P.S 在我的旧电脑上运行完美。相同的节点,npm 版本。我还将所有 AppData/npm AppData/npm-cache 文件夹复制到新 PC - 但仍然无法正常工作。

也许有人面临同样的问题?也许缺少某些权限?

【问题讨论】:

  • 在你的机器上安装wsl
  • 或任何为您提供 bash shell 的软件(cygwin 等)
  • @EmanuelVintilă 谢谢,工作完美:) 你为我节省了很多时间。你可以提交你的答案

标签: node.js npm


【解决方案1】:

根据这些错误消息,您应该安装为您的系统提供 bash shell 的软件(WSL、CygWin 等)

3101 error file bash
3102 error path bash
3103 error code ELIFECYCLE
3104 error errno ENOENT
3105 error syscall spawn bash
3106 error node-sass@4.13.0 install: `node scripts/install.js`
3106 error spawn bash ENOENT

【讨论】:

    【解决方案2】:

    根据node-sass docs需要安装node-gyp prerequisites

    【讨论】:

    • 您是否从提升的 PowerShell 或 CMD.exe(以管理员身份运行)运行 npm install --global --production windows-build-tools
    • 是并且出现错误:> windows-build-tools@5.2.2 postinstall C:\Users\USER\.npm-global\node_modules\windows-build-tools > node ./dist/index .js npm 错误! windows-build-tools@5.2.2 安装后:node ./dist/index.js npm ERR! windows-build-tools@5.2.2 安装后脚本失败。我使用 --ignore-scripts 安装并成功安装,但它也无法正常工作。
    猜你喜欢
    • 2019-09-08
    • 2019-03-16
    • 2018-04-07
    • 2014-11-19
    • 1970-01-01
    • 2022-10-06
    • 2018-08-19
    • 2018-08-23
    • 1970-01-01
    相关资源
    最近更新 更多