Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Why do I need Python? #1176

Closed
glen-84 opened this issue Sep 24, 2015 · 10 comments
Closed

Why do I need Python? #1176

glen-84 opened this issue Sep 24, 2015 · 10 comments

Comments

@glen-84
Copy link

glen-84 commented Sep 24, 2015

I get the following output when installing [email protected]:

$ npm install
npm WARN install Couldn't install optional dependency: Unsupported
npm WARN prefer global [email protected] should be installed with -g

> [email protected] install D:\Programming\Git\github\x\node_modules\bufferutil
> node-gyp rebuild


D:\Programming\Git\github\x\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Programming\Git\github\x\node_modules\bufferutil
gyp ERR! node -v v4.1.0
gyp ERR! node-gyp -v v3.0.1
gyp ERR! not ok
npm WARN install:bufferutil [email protected] install: `node-gyp rebuild`
npm WARN install:bufferutil Exit status 1

> [email protected] install D:\Programming\Git\github\x\node_modules\utf-8-validate
> node-gyp rebuild


D:\Programming\Git\github\x\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Programming\Git\github\x\node_modules\utf-8-validate
gyp ERR! node -v v4.1.0
gyp ERR! node-gyp -v v3.0.1
gyp ERR! not ok
npm WARN install:utf-8-validate [email protected] install: `node-gyp rebuild`
npm WARN install:utf-8-validate Exit status 1

> [email protected] install D:\Programming\Git\github\x\node_modules\node-sass
> node scripts/install.js

Binary downloaded and installed at D:\Programming\Git\github\x\node_modules\node-sass\vendor\win32-x64-46\binding.node

> [email protected] postinstall D:\Programming\Git\github\x\node_modules\spawn-sync
> node postinstall


> [email protected] postinstall D:\Programming\Git\github\x\node_modules\node-sass
> node scripts/build.js

` D:\Programming\Git\github\x\node_modules\node-sass\vendor\win32-x64-46\binding.node ` exists.
 testing binary.
Binary is fine; exiting.
npm WARN prefer global [email protected] should be installed with -g

> [email protected] install D:\Programming\Git\github\x\node_modules\node-sass
> node scripts/install.js


> [email protected] postinstall D:\Programming\Git\github\x\node_modules\node-sass
> node scripts/build.js

` D:\Programming\Git\github\x\node_modules\node-sass\vendor\win32-x64-46\binding.node ` exists.
 testing binary.
Binary is fine; exiting.

> [email protected] postinstall D:\Programming\Git\github\x\node_modules\spawn-sync
> node postinstall

Do I really have to install Python, or is this a bug?

@saper
Copy link
Member

saper commented Sep 24, 2015

bufferutil is not required by node-sass.

You need Python and a C++ to be able to compile native modules. Normally node-sass fetches the binary for you, if you are on a supported platform - as you see above, it downloaded fine.

But your particular problem is about https://github.com/websockets/bufferutil and not node-sass.

@glen-84
Copy link
Author

glen-84 commented Sep 25, 2015

My apologies.

@saper
Copy link
Member

saper commented Sep 25, 2015

No problem! I hope you got it working anyway.

@FossPrime
Copy link

FossPrime commented Aug 16, 2017

Well since this was a royal pain and this is the first Google result... Here goes nothing.

If you keep getting errors on Ubuntu about python3 and python2.7 is installed and passing --python /usr/bin/python2.7 results in an arcane error when trying to install node-sass. The best way to fix it is to ignore its suggestion and just make python2.7 available as python2 in the path with something like ln -s /usr/bin/python2.7 python2

familiar python3 error

gyp ERR! stack Error: Python executable "/usr/bin/python" is v3.5.2, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.

less familiar error with the suggested --python "fix"

gyp ERR! stack Error: Python executable "/bin/true" is v, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.

"node-sass": "4.5.3"

@xzyfer
Copy link
Contributor

xzyfer commented Aug 17, 2017

Native Node JS extensions like node-sass are compiled via npm which uses node-gyp. Python is required by node-gyp. We supply a bunch of precompiled binaries with out releases so you don't have to compile them yourself.

During the npm install process a binary is downloaded for your system. If you're on a system we haven't pre-compiled binaries for then npm will try to compile it for you, which is where python comes in.

Since you're one linux there should be a binary for you. This likely means you're running very old version of node-sass. You should always update to the latest version of a package. Please open a new issue if you continue to encounter errors with [email protected].

@phawxby
Copy link

phawxby commented Aug 23, 2017

I'm getting the same error on Windows 10 x64. That should probably be one of the precompiled binaries considering how common it is.

@FossPrime
Copy link

@phawxby @xzyfer I believe I was using npm rebuild node-sass --force since I was mounting a my repo from a mac to an ubuntu docker, the binaries would not work. Perhaps if I had just npm cache clean and npm install I would have gotten a prebuilt binary.

@xzyfer
Copy link
Contributor

xzyfer commented Aug 23, 2017

Using the --force flag will compile the binary locally which is why you need python. Rebuild without force should fetch the appropriate binary if it's not already present locally.

@xzyfer
Copy link
Contributor

xzyfer commented Aug 23, 2017

@phawxby your issue is unrelated. You're likely using an old version of node-sass with node 8. Update to 4.5.3.

@phawxby
Copy link

phawxby commented Aug 24, 2017

You are correct. For some reason I was stuck on 4.5.2

@sass sass locked and limited conversation to collaborators Aug 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants