NodeJS Pipeline: Node vs atlassian image
Asked by Admin Admin:

Hello,

specifying "image: node:14.X" in the pipeline leads to the "npm install" failure. The "npm install" will also fail, if I use "node:16".

But if I specify " image:atlassian/default-image:3" the " npm install" will succeed.

According to the [documentation](https://support.atlassian.com/bitbucket-cloud/docs/use-docker-images-as-build-environments/):

* node: 14.17.5

++Question++:

what makes the images different?

Bitbucket_pipelines.yml:

working version:

````
image: atlassian/default-image:3

pipelines:
default:
- parallel:
- step:
name: Build and Test
caches:
- node
script:
- npm install

```
````

Failing version:

```
image: node:14.17.5

pipelines:
default:
- parallel:
- step:
name: Build and Test
caches:
- node
script:
- npm install


```

Log:


    npm ERR! checking the name lister (/usr/bin/nm -B) interface... BSD nm

    npm ERR! checking whether ln -s works... yes

    npm ERR! checking the maximum length of command line arguments... 1572864

    npm ERR! checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop

    npm ERR! checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop

    npm ERR! checking for /usr/bin/ld option to reload object files... -r

    npm ERR! checking for objdump... objdump

    npm ERR! checking how to recognize dependent libraries... pass_all

    npm ERR! checking for dlltool... no

    npm ERR! checking how to associate runtime and link libraries... printf %s\n

    npm ERR! checking for archiver @FILE support... @

    npm ERR! checking for strip... strip

    npm ERR! checking for ranlib... ranlib

    npm ERR! checking command to parse /usr/bin/nm -B output from gcc object... ok

    npm ERR! checking for sysroot... no

    npm ERR! checking for a working dd... /bin/dd

    npm ERR! checking how to truncate binary pipes... /bin/dd bs=4096 count=1

    npm ERR! checking for mt... no

    npm ERR! checking if : is a manifest tool... no

    npm ERR! checking for ANSI C header files... yes

    npm ERR! checking for sys/types.h... yes

    npm ERR! checking for sys/stat.h... yes

    npm ERR! checking for stdlib.h... yes

    npm ERR! checking for string.h... yes

    npm ERR! checking for memory.h... yes

    npm ERR! checking for strings.h... yes

    npm ERR! checking for inttypes.h... yes

    npm ERR! checking for stdint.h... yes

    npm ERR! checking for unistd.h... yes

    npm ERR! checking for dlfcn.h... yes

    npm ERR! checking for objdir... .libs

    npm ERR! checking if gcc supports -fno-rtti -fno-exceptions... no

    npm ERR! checking for gcc option to produce PIC... -fPIC -DPIC

    npm ERR! checking if gcc PIC flag -fPIC -DPIC works... yes

    npm ERR! checking if gcc static flag -static works... yes

    npm ERR! checking if gcc supports -c -o file.o... yes

    npm ERR! checking if gcc supports -c -o file.o... (cached) yes

    npm ERR! checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes

    npm ERR! checking dynamic linker characteristics... GNU/Linux http://ld.so/

    npm ERR! checking how to hardcode library paths into programs... immediate

    npm ERR! checking whether stripping libraries is possible... yes

    npm ERR! checking if libtool supports shared libraries... yes

    npm ERR! checking whether to build shared libraries... no

    npm ERR! checking whether to build static libraries... yes

    npm ERR! checking whether ln -s works... yes

    npm ERR! checking for pkg-config... /usr/bin/pkg-config

    npm ERR! checking pkg-config is at least version 0.9.0... yes

    npm ERR! checking size of size_t... 8

    npm ERR! checking whether compiler supports pointers to undefined structures... yes

    npm ERR! checking whether __SUNPRO_C is declared... no

    npm ERR! checking for pow in -lm... yes

    npm ERR! checking for libpng... yes

    npm ERR! checking for ANSI C header files... (cached) yes

    npm ERR! checking stddef.h usability... yes

    npm ERR! checking stddef.h presence... yes

    npm ERR! checking for stddef.h... yes

    npm ERR! checking for stdlib.h... (cached) yes

    npm ERR! checking locale.h usability... yes

    npm ERR! checking locale.h presence... yes

    npm ERR! checking for locale.h... yes

    npm ERR! checking for string.h... (cached) yes

    npm ERR! checking for sys/types.h... (cached) yes

    npm ERR! checking for an ANSI C-conforming const... yes

    npm ERR! checking whether char is unsigned... no

    npm ERR! checking for inline... inline

    npm ERR! checking for size_t... yes

    npm ERR! checking for unsigned char... yes

    npm ERR! checking for unsigned short... yes

    npm ERR! checking if right shift is signed... yes

    npm ERR! checking for memset... yes

    npm ERR! checking for memcpy... yes

    npm ERR! checking libjpeg API version... 8.0

    npm ERR! checking libjpeg shared library version... 8.1.2

    npm ERR! checking whether the linker supports version scripts... yes (GNU style)

    npm ERR! checking whether to use version script when building mozjpeg... yes

    npm ERR! checking for inline... inline __attribute__((always_inline))

    npm ERR! checking whether to include arithmetic encoding support... yes

    npm ERR! checking whether to include arithmetic decoding support... yes

    npm ERR! checking whether to use 12-bit samples... no

    npm ERR! checking whether to build TurboJPEG C wrapper... yes

    npm ERR! checking whether to build TurboJPEG Java wrapper... no

    npm ERR! checking if we have SIMD optimisations for cpu type... yes (x86_64)

    npm ERR! checking for nasm... no

    npm ERR! checking for nasmw... no

    npm ERR! checking for yasm... no

    npm ERR! 

    npm ERR! at /opt/atlassian/pipelines/agent/build/node_modules/bin-build/node_modules/execa/index.js:231:11

    npm ERR! at runMicrotasks (<anonymous>)

    npm ERR! at processTicksAndRejections (internal/process/task_queues.js:95:5)

    npm ERR! at async Promise.all (index 0)

    npm ERR! A complete log of this run can be found in:

    npm ERR! /root/.npm/_logs/2022-01-23T22_52_48_131Z-debug-0.log



Answers:
author: Pramodh M
body: Hi [@Admin Admin](/t5/user/viewprofilepage/user-id/4720087)

node doesn't have your scripts pipe defined

```
name: Build and Test
caches:
- node
script:
- npm install
```

So this part will fail if you use node image!!

You can use the Atlassian Image and then modify based on what software you need to use while building a pipeline

*** ** * ** ***

If you need to use a node image, find where the node path is, and add it, then you will be able to use it

Let me know if you need further clarification

Thanks,  
Pramodh

comments: author: Admin Admin
body: [@Pramodh M](/t5/user/viewprofilepage/user-id/3691224):

thank you for a quick reply.

\> .. If you need to use a node image, find where the node path is, and add it, then you will be able to use it

what is the "node path"?

sorry, I'm not familiar with the node ecosystem.

What i find odd is that "image : node" is used in the pipeline template in the BB for NodeJs builds...


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

node.js