npm install throwing error in node-sass

╄→尐↘猪︶ㄣ 提交于 2019-12-11 01:38:57

问题


node-sass@2.1.1 install /home/user/Documents/project/node_modules/node-sass
> node scripts/install.js

WARN invalid config loglevel="notice"
Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.1.1/linux-x64-node-8.2/binding.node

> node-sass@2.1.1 postinstall /home/user/Documents/project/node_modules/node-sass
> node scripts/build.js

module.js:487
    throw err;
    ^

Error: Cannot find module '/home/user/Documents/project/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:575:3
Build failed
added 2186 packages in 42.166s

I tried so far:

  • npm rebuild
  • npm rebuild node-sass
  • npm uninstall -g node-sass
  • rm -rf node_module

  • 回答1:


    The minimum version with Node 8 support is 4.5.3. Offhand, I don't think 2.x will support anything above Node 0.12, which is EOL.




    回答2:


    You need to do next steps and it should work:

    rm -rf node_modules package-lock.json 
    npm install --saveDev node-sass@4.5.3 
    npm install
    

    Voila :)



    来源:https://stackoverflow.com/questions/45589179/npm-install-throwing-error-in-node-sass

    易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!