npm install throwing error in node-sass

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>[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
</code>
<code>[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 </code>
[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
  • 3

    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! 🙂

    4

    You need to do next steps and it should work:

    Plain text
    Copy to clipboard
    Open code in new window
    EnlighterJS 3 Syntax Highlighter
    <code>rm -rf node_modules package-lock.json
    npm install --saveDev [email protected]
    npm install
    </code>
    <code>rm -rf node_modules package-lock.json npm install --saveDev [email protected] npm install </code>
    rm -rf node_modules package-lock.json 
    npm install --saveDev [email protected] 
    npm install
    

    Voila 🙂

    1

    by using yarn run:

    Plain text
    Copy to clipboard
    Open code in new window
    EnlighterJS 3 Syntax Highlighter
    <code>yarn add node-sass
    </code>
    <code>yarn add node-sass </code>
    yarn add node-sass
    

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

    0

    Removed package-lock.json, installed Python 2.7, added an env variable for python path.
    Ran npm install.
    Voila !

    Use

    • Node : v14.16.0
    • node-sass: ^4.14.1

    it works for me

    This question is old, but if you arrive here in 2022 or later, then this info may be useful:

    node-sass is deprecated. Now you should use sass.

    That’s why the answer given by Usama Muhammad works. Hope this helps.

    Sources:

    • https://www.npmjs.com/package/node-sass
    • https://www.npmjs.com/package/dart-sass

    1. Delete package-lock.json
    2. Remove ‘node-sass’ dependency from your package.json
    3. run npm install
    4. run npm gulp-sass –save-dev
    5. run npm i -d sass
    6. run npm start

    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.

    I have found I get node-sass errors when trying to install over a corporate proxy. The first solution is to ensure your .npmrc file has proxy allowance.

    .npmrc

    Plain text
    Copy to clipboard
    Open code in new window
    EnlighterJS 3 Syntax Highlighter
    <code># Try removing reference to registry, as sometimes your local corporate registry of node_modules may not include node-sass
    # // registry=https://....
    # note if using special characters in pass, encode them: eg: h@ppy = h%40ppy
    strict-ssl=false
    proxy=http://<username>:<pass>@proxyhost:<port>
    https-proxy=http://<uname>:<pass>@proxyhost:<port>
    </code>
    <code># Try removing reference to registry, as sometimes your local corporate registry of node_modules may not include node-sass # // registry=https://.... # note if using special characters in pass, encode them: eg: h@ppy = h%40ppy strict-ssl=false proxy=http://<username>:<pass>@proxyhost:<port> https-proxy=http://<uname>:<pass>@proxyhost:<port> </code>
    # Try removing reference to registry, as sometimes your local corporate registry of node_modules may not include node-sass
    # // registry=https://....
    
    # note if using special characters in pass, encode them: eg: h@ppy = h%40ppy
    strict-ssl=false
    proxy=http://<username>:<pass>@proxyhost:<port>
    https-proxy=http://<uname>:<pass>@proxyhost:<port>
    

    NODE_TLS_REJECT_UNAUTHORIZED = 0

    Then in command line before running any install

    Plain text
    Copy to clipboard
    Open code in new window
    EnlighterJS 3 Syntax Highlighter
    <code>set NODE_TLS_REJECT_UNAUTHORIZED = 0
    </code>
    <code>set NODE_TLS_REJECT_UNAUTHORIZED = 0 </code>
    set NODE_TLS_REJECT_UNAUTHORIZED = 0
    

    Zip node-binding files from node-sass github site in order to download them over corporate network.

    Example:
    https://github.com/inspiraller/node-sass-bindings

    Add manually in package.json : “node-sass”: “4.13.0”

    and update package.json in terminal npm install

    Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
    Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
    Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật