Could not install serialport module use npm


ı have a node application. ı want to run this application on colibri imx6 computer on module.

operation system ınformation in here :

uname - a

Linux colibri-imx6 3.14.28-dirty #1 SMP Thu Feb 11 11:52:00 EET 2016 armv7l GNU/Linux

ı run this commands before installation;

opkg update
opkg install packagegroup-sdk-target

than install nodejs and and npm

opkg install nodejs nodejs-npm

than ı check phyton version gcc version node version npm version ;

python -V

Python 2.7.9

node -v 

npm -v


gcc -v

Using built-in specs.
Target: arm-angstrom-linux-gnueabi
Configured with: /build/jenkins/v2015.06/machine/beaglebone/build/tmp-angstrom_v2015_06-glibc/work-shared/gcc-linaro-4.9-r2015.03/gcc-linaro-4.9-2015.03/configure --build=x86_64-linux --host=arm-angstrom-linux-gnueabi --target=arm-angstrom-linux-gnueabi --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib/gcc --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/build/jenkins/v2015.06/machine/beaglebone/build/tmp-angstrom_v2015_06-glibc/sysroots/beaglebone --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-angstrom-linux-gnueabi- --without-local-prefix --enable-target-optspace --enable-lto --enable-libssp --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --with-float=hard --with-sysroot=/ --with-build-sysroot=/build/jenkins/v2015.06/machine/beaglebone/build/tmp-angstrom_v2015_06-glibc/sysroots/beaglebone --with-native-system-header-dir=/build/jenkins/v2015.06/machine/beaglebone/build/tmp-angstrom_v2015_06-glibc/sysroots/beaglebone/usr/include --with-gxx-include-dir=/usr/include/c++/4.9.3 --enable-nls --with-arch=armv7-a
Thread model: posix
gcc version 4.9.3 20150311 (prerelease) (Linaro GCC 4.9-2015.03)

now ı create a directory name of nodeapp than create project

mkdir nodeapp

cd nodeapp

touch app.js

npm init --yes

npm install serialport --save

but ı take an error :

root@colibri-imx6:~/nodeapp# npm install serialport --save

npm WARN package.json nodeapp@1.0.0 No description

npm WARN package.json nodeapp@1.0.0 No repository field.

npm WARN package.json nodeapp@1.0.0 No README data


> serialport@2.0.6 install /home/root/nodeapp/node_modules/serialport

> node-pre-gyp install --fallback-to-build

Traceback (most recent call last):

  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/", 

line 15, in <module>

    import gyp

  File "/usr/lib/node_modules/npm/node_modules/node-

gyp/gyp/pylib/gyp/", line 8, in <module>

    import gyp.input

  File "/usr/lib/node_modules/npm/node_modules/node-

gyp/gyp/pylib/gyp/", line 5, in <module>

    from compiler.ast import Const

ImportError: No module named compiler.ast

gyp ERR! configure error

gyp ERR! stack Error: `gyp` failed with exit code: 1

gyp ERR! stack     at ChildProcess.onCpExit 


gyp ERR! stack     at ChildProcess.emit (events.js:110:17)

gyp ERR! stack     at Process.ChildProcess._handle.onexit 


gyp ERR! System Linux 3.14.28-dirty

gyp ERR! command "/usr/bin/node" 


"configure" "--fallback-to-build" "--


v14-linux-arm/serialport.node" "--module_name=serialport" "--



gyp ERR! cwd /home/root/nodeapp/node_modules/serialport

gyp ERR! node -v v0.12.2

gyp ERR! node-gyp -v v1.0.3

gyp ERR! not ok

node-pre-gyp ERR! build error

node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node 

/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure 

--fallback-to-build --


v14-linux-arm/serialport.node --module_name=serialport --


de-v14-linux-arm' (1)

node-pre-gyp ERR! stack     at ChildProcess.<anonymous> 



node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:110:17)

node-pre-gyp ERR! stack     at maybeClose (child_process.js:1015:16)

node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit 


node-pre-gyp ERR! System Linux 3.14.28-dirty

node-pre-gyp ERR! command "node" 


gyp" "install" "--fallback-to-build"

node-pre-gyp ERR! cwd /home/root/nodeapp/node_modules/serialport

node-pre-gyp ERR! node -v v0.12.2

node-pre-gyp ERR! node-pre-gyp -v v0.6.18

node-pre-gyp ERR! not ok

Failed to execute '/usr/bin/node 

/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure 

--fallback-to-build --


v14-linux-arm/serialport.node --module_name=serialport --


de-v14-linux-arm' (1)

npm ERR! Linux 3.14.28-dirty

npm ERR! argv "node" "/usr/bin/npm" "install" "serialport" "--save"

npm ERR! node v0.12.2

npm ERR! npm  v2.7.4


npm ERR! serialport@2.0.6 install: `node-pre-gyp install --fallback-to-build`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the serialport@2.0.6 install script 'node-pre-gyp install --


npm ERR! This is most likely a problem with the serialport package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR!     node-pre-gyp install --fallback-to-build

npm ERR! You can get their info via:

npm ERR!     npm owner ls serialport

npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

npm ERR!     /home/root/nodeapp/npm-debug.log


please help me about this problem so important for us.

thank you so much …

What exact BSP version do you use? (Check login screen or use cat /etc/issue).

Can you provide the output of opkg list_installed | grep libc6?

There are a few other dependencies that are required for this module to build.

First, the architecture tune was changed for the upstream package libc6-dev and subsequently was moved to another repo arch by Angstrom - our upstream distro. You’ll want this package installed for native compilation on the target. You can install it by doing the following:

echo "src/gz base2" >> /etc/opkg/base-feed.conf
opkg update
opkg install libc6-dev

Note: libc6-dev is normally installed in the process of installing packagegroup-sdk-target. This issue is resolved in future image releases.

Then you will also need a few more python packages:

opkg install python-misc python-compiler python-multiprocessing

Finally, you should be able to install the serialport node module:

npm install serialport --save

thank you so much brandon.shibley your answer fix my problem.