Skip to content

node-gyp 问题 #7

Description

@fairyly

升级了 node v10.15.3

升级了 python 3.7

在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
生成启动时间为 2019/11/10 16:06:59。
节点 1 上的项目“J:\公司\office-web\node_modules\node-sass\build\binding.sln”(默认目标)。
ValidateSolutionConfiguration:
  正在生成解决方案配置“Release|x64”。
项目“J:\公司\office-web\node_modules\node-sass\build\binding.sln”(1)正在节点 1 上生成“J:\公司\office-web\node_modules\node-sass\buil
d\binding.vcxproj.metaproj”(2) (默认目标)。
项目“J:\公司\office-web\node_modules\node-sass\build\binding.vcxproj.metaproj”(2)正在节点 1 上生成“J:\公司\office-web\node_modules\n
ode-sass\build\src\libsass.vcxproj”(3) (默认目标)。
J:\公司\office-web\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: 未找到导入的项目“J:\Microsoft.Cpp.Defau
lt.props”。请确认 <Import> 声明中的路径正确,且磁盘上存在该文件。
已完成生成项目“J:\公司\office-web\node_modules\node-sass\build\src\libsass.vcxproj”(默认目标)的操作 - 失败。

已完成生成项目“J:\公司\office-web\node_modules\node-sass\build\binding.vcxproj.metaproj”(默认目标)的操作 - 失败。

已完成生成项目“J:\公司\office-web\node_modules\node-sass\build\binding.sln”(默认目标)的操作 - 失败。


生成失败。

“J:\公司\office-web\node_modules\node-sass\build\binding.sln”(默认目标) (1) ->
“J:\公司\office-web\node_modules\node-sass\build\binding.vcxproj.metaproj”(默认目标) (2) ->
“J:\公司\office-web\node_modules\node-sass\build\src\libsass.vcxproj”(默认目标) (3) ->
  J:\公司\office-web\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: 未找到导入的项目“J:\Microsoft.Cpp.Def
ault.props”。请确认 <Import> 声明中的路径正确,且磁盘上存在该文件。

    0 个警告
    1 个错误

已用时间 00:00:00.54
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (J:\公司\office-web\node_modules\node-sass\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "G:\\Program Files\\nodejs\\node.exe" "J:\\公司\\office-web\\node_modules\\node-sass\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd J:\公司\office-web\node_modules\node-sass
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN eslint-loader@1.9.0 requires a peer of eslint@>=1.6.0 <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-vue@4.7.1 requires a peer of eslint@^3.18.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords@3.4.1 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords@3.4.1 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords@3.4.1 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN haoban-web@1.10.0 No repository field.
npm WARN haoban-web@1.10.0 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.13.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.13.0 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:\Users\fairy\AppData\Roaming\npm-cache\_logs\2019-11-10T08_07_02_259Z-debug.log

此处仅列出Window环境安装:

  • 安装gyp命令 npm install -g node-gyp (项目莫名的已有此插件,跳过);
  • 安装Visual C ++构建环境:Visual Studio构建工具
  • 安装Python 2.7(v3.x.x不支持),安装后要配置环境变量。成功后执行npm config set python python2.7
  • 执行 npm config set msvs_version 2017

又出现

ajv-keywords@3.4.1 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
  • 更新本机的npm到最新版本:npm install -g npm

最后 node-sass -v

提示

Error: Missing binding C:\Users\fairy\AppData\Roaming\npm\node_modules\node-sass\vendor\win32-x64-64\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 10.x

Found bindings for the following environments:
  - Windows 64-bit with Node.js 8.x
  • 全局安装
npm i -g node-sass@latest

npm rebuild node-sass --force
  • 卸载python3,安装 python 2.7

  • npm rebuild node-sass

  • npm install node-sass --save-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions