Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install throwing error in node-sass

[email protected] 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

> [email protected] 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
  • like image 239
    Jahanzaib Seyal Avatar asked Aug 09 '17 11:08

    Jahanzaib Seyal


    People also ask

    How do I use node-Sass in NPM?

    To make node-sass available in your source code, npm needs to build the package and create a binding for your environment. When you change the version of Node.js used on your project, then the binding needs to be rebuild so that node-sass can be imported and executed from your code.

    Where can I find NPM err logs for Windows NT?

    npm ERR! gyp ERR! System Windows_NT 10.0.19041 npm ERR! Build failed with error code: 1 npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Solomon Iseh\AppData\Local pm-cache_logs\2021-04-20T13_48_12_336Z-debug.log

    Why do I need to run NPM rebuild node-Sass?

    Learn why you need to constantly rebuild node-sass to make it work The node-sass package is a library that provides binding for Node.js to LibSass, which is the Sass processsor written in C++. When running a project that has a dependency on node-sass, you may see an error that says you need to run npm rebuild node-sass as shown below:

    How to find installed node version in NVM?

    It will list down all your installed node versions in console by using "nvm llist" command and you can switch to your specified node version when needed by this command "nvm use NODE_VERSION" Sorry, something went wrong. Sorry, something went wrong. hmm getting this though on the right version of node; something to do with yarn; npm is fine


    Video Answer


    3 Answers

    1. Remove 'node-sass' dependency from your package.json
    2. run npm install
    3. run npm i sass
    4. run npm start

    You're ready to go! :)

    like image 150
    Usama Muhammad Avatar answered Oct 16 '22 08:10

    Usama Muhammad


    node-sass has minimum dependency according to the version of node installed in your system. You can find out the minimum version required here

    like image 23
    Kirtan Desai Avatar answered Oct 16 '22 06:10

    Kirtan Desai


    by using yarn run:

    yarn add node-sass
    
    like image 22
    iaMartisan Avatar answered Oct 16 '22 08:10

    iaMartisan