Node.js: Python not found exception due to node-sass and node-gyp

前端 未结 12 1331
余生分开走
余生分开走 2020-12-04 15:22

Suddenly in one of my jenkins environment build has started failing, while in local machine it seems to be working fine as i have python installed,

From the logs i w

相关标签:
12条回答
  • 2020-12-04 15:34

    I had to:

    Delete node_modules
    Uninstall/reinstall node
    npm install node-sass@4.12.0
    

    worked fine after forcing it to the right sass version, according to the version said to be working with the right node.

    NodeJS  Minimum node-sass version   Node Module
    Node 12 4.12+   72
    Node 11 4.10+   67
    Node 10 4.9+    64
    Node 8  4.5.3+  57
    

    There was lots of other errors that seemed to be caused by the wrong sass version defined.

    0 讨论(0)
  • 2020-12-04 15:34

    had the same issue lost hours trying to install different version of python on my PC. Simply Upgrade node to the latest version v8.11.2 and npm 5.6.0, then after install node-sass@4.5.3 and you'll be fine.

    0 讨论(0)
  • 2020-12-04 15:38

    My machine is Windows 10, I've faced similar problems while tried to compile SASS using node-sass package. My node version is v10.16.3 and npm version is 6.9.0

    The way that I resolved the problem:

    1. At first delete package-lock.json file and node_modules/ folder.
    2. Open Windows PowerShell as Administrator.
    3. Run the command npm i -g node-sass.
    4. After that, go to the project folder and run npm install
    5. And finally, run the SASS compiling script, in my case, it is npm run build:css

    And it works!!

    0 讨论(0)
  • 2020-12-04 15:38

    The error message means that it cannot locate your python executable or binary.

    In many cases, it's installed at c:\python27. if it's not installed yet, you can install it with npm install --global windows-build-tools, which will only work if it hasn't been installed yet.

    Adding it to the environment variables does not always work. A better alternative, is to just set it in the npm config.

    npm config set python c:\python27\python.exe

    0 讨论(0)
  • 2020-12-04 15:43

    My answer might not apply to everyone. Node version: v10.16.0 NPM: 6.9.0

    I was having a lot of trouble using node-sass and node-sass-middleware. They are interesting packages because they are widely used (millions of downloads weekly), but their githubs show a limited dependencies and coverage. I was updating an older platform I'd been working on.

    What I ended up having to do was:

    1) Manually Delete node_modules

    2) Manually Delete package-lock.json

    3) sudo npm install node-sass --unsafe-perm=true --allow-root

    4) sudo npm install node-sass-middleware --unsafe-perm=true --allow-root

    I had the following help, thanks!

    Pre-built binaries not found for grpc@1.10.1 and node@10.9.0

    Error: EACCES: permission denied when trying to install ESLint using npm

    0 讨论(0)
  • 2020-12-04 15:45

    Hey I got this error resolved by following the steps

    • first I uninstalled python 3.8.6 (latest version)
    • then I installed python 2.7.1 (any Python 2 version will work, but not much older and this is recommended)
    • then I added c:\python27 to environment variables
    • my OS is windows, so I followed this link
    • It worked
    0 讨论(0)
提交回复
热议问题