node-gyp

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

node-gyp

4,095 Views
niklasmolin
Senior Contributor I

Hi.

I wonder if someone has used node-gyp in the image generated by Yocto?

When I try to use this, then I get following error:

Traceback (most recent call last):

  File "/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py", line 15, in <module>

    import gyp

  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module>

    import gyp.input

  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 5, in <module>

    from compiler.ast import Const

ImportError: No module named compiler.ast

I also get the same error if I try to use this in cross compiling environment.

Thanks,

Niklas

Labels (2)
0 Kudos
8 Replies

1,663 Views
stevezilla
Contributor II

In case anyone else has this problem... I ran into this same issue and ended up resolving it by adding "python-compiler" to IMAGE_INSTALL_append:

IMAGE_INSTALL_APPEND += " python-compiler "

0 Kudos

1,663 Views
LeonardoSandova
Specialist I

How did you include the recipe? adding its metadata into sources directory and then installing it through local.conf?

0 Kudos

1,663 Views
niklasmolin
Senior Contributor I

I tried to install Python 2.7.6, direct on the ARM.

Then it worked.

So now I can run the node-gyp configure (also manage to build the code I tried to build, when I faced this problem).

Not sure why the Python that is included in the Yocto build doesn't support the compiler.ast .

1,663 Views
LeonardoSandova
Specialist I

It may be the case that the the Python Yocto version is older than the one you install, and it does not include that library/module

One fast way to check the recipe version is

$ bitbake python -e | grep PV=

if that is the case, update python's recipe version and bake again.

0 Kudos

1,663 Views
niklasmolin
Senior Contributor I

I checked both the version running on my desktop and the one on the ARM, and both where 2.7.3 (which should be okay).

I can try to figure out what happens when Yocto installs the python, why this is not included.

But for now I can go for my manually installed version.

0 Kudos

1,663 Views
LeonardoSandova
Specialist I

All the steps you did when manually installing should match the steps indicating by the recipe. To really check what bitbake will do

bitbake -e python > python.env

In case you want, try to spend more time fixing the issue on Yocto. You may get a patch to send to the community :smileyhappy:

0 Kudos

1,663 Views
niklasmolin
Senior Contributor I

Hi Leonardo.

I'll see if I have some time during the weekend to look at it.

First I just wanted to check if someone in the community knew if there is a reason why some "parts" were missing in Python build in the Linux image.

I have a few other things that I need to check why they are missing (for instance e2fsprogs and that I only have a "light" version of the binutils), even though I have included them in my build.

Thanks,

Niklas

0 Kudos

1,663 Views
niklasmolin
Senior Contributor I

I tried to first compile it on the ARM, after I installed node-gyp (which is done with npm, and that part went well).

I also tried to do the node-gyp in the cross-compile environment on my desktop, but get the same result.

It seems like the compiler.ast is missing for the python setup (both in the ARM a and the cross-compiler environment), since when I start python and try to import that package, it can't find it (which I can do if I start python in my "normal" desktop).

0 Kudos