Npm安装构建失败

时间:2019-05-31 10:21:12

标签: angular npm-install node-sass

我已经安装了node-sass v4.12.0,但是当我执行npm i时,出于某种原因它使用4.9.4。我不知道4.9.4是从哪里获得的,因为在我的package.json中,我使用的是4.12.0。

我的节点版本:12.3.1

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\OneHipFrontend\Development\Code\Client\OneHip.Web\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\OneHipFrontend\\Development\\Code\\Client\\OneHip.Web\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags="
"--libsass_library="
gyp ERR! cwd C:\OneHipFrontend\Development\Code\Client\OneHip.Web\node_modules\@angular-devkit\build-angular\node_modules\node-sass
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.4 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.9.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

c:\onehipfrontend\development\code\client\onehip.web\node_modules\@angular-devkit\build-angular\node_modules\node-sass\src\create_string.cpp(17): error C2664: 'v8::String::Utf8Value::Utf8Value(const v8::String::Utf8Value &)': cannot convert argument 1 from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value &' [C:\OneHipFrontend\Development\Code\Client\OneHip.Web\node_modules\@angular-devkit\build-angular\node_modules\node-sass\build\binding.vcxproj]

c:\OneHipFrontend\Development\Code\Client\OneHip.Web\node_modules\@angular-devkit\build-angular\node_modules\node-sass\build\binding.sln" (default target) (1) -> c:\OneHipFrontend\Development\Code\Client\OneHip.Web\node_modules\@angular-devkit\build-angular\node_modules\node-sass\build\binding.vcxproj.metaproj" (default target) (2) ->c:\OneHipFrontend\Development\Code\Client\OneHip.Web\node_modules\@angular-devkit\build-angular\node_modules\node-sass\build\binding.vcxproj" (default target) (4) -> (ClCompile target) ->   c:\onehipfrontend\development\code\client\onehip.web\node_modules\@angular-devkit\build-angular\node_modules\node-sass\src\create_string.cpp(17): error C2664: 'v8::String::Utf8Value::Utf8Value(const v8::String::Utf8Value &)': cannot convert argument 1 from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value &' [C:\OneHipFrontend\Development\Code\Client\OneHip.Web\node_modules\@angular-devkit\build-angular\node_modules\node-sass\build\binding.vcxproj]

我尝试过的事情:

  • 清除缓存
  • 删除了节点模块
  • 已删除包锁
  • 已经尝试过npm重建node-sass
  • 在新文件夹中启动项目。

到目前为止没有任何进展

2 个答案:

答案 0 :(得分:0)

在该文件夹中,看起来旧版本是https://www.npmjs.com/package/@angular-devkit/build-angular的依赖项,但是在该依赖项中我没有看到对node-sass的明确提及。 如果将子依赖关系固定到node-sass 4.9.4,则将兼容的Node的最高版本为Node 10 https://github.com/sass/node-sass#supported-nodejs-versions-vary-by-release-please-consult-the-releases-page-below-is-a-quick-guide-for-minimium-support

答案 1 :(得分:0)

我的问题通过安装nodeJs 11.0.15版本解决。 完成此操作后,我的“ npm安装”即可正常工作。