Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to build angular2 project in Bitbucket Pipelines?

Yves Candel July 19, 2016

I'm trying to build the popular angular2-seed project (https://github.com/mgechev/angular2-seed) for my Angular2 projects, but I cannot get it to work in any way with pipelines. It keeps throwing a ts-node error which I cannot find any solution for. I tried installing them globally but it didnt change anything at all.

Would love to get this to work so please help! I have searched online for hours and tried a lot of things but no result yet...

Here is my bitbucket-pipelines.yml file:

# You can use a Docker image from Docker Hub or your own container
# registry for your build environment.
image: node:6.3.0

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - node --version
          - npm --version
          - npm install -g gulp ts-node typescript
          - npm install
          - npm run build.prod

Here's the error:

npm run build.prod
npm info it worked if it ends with ok
npm info using npm@3.10.3
npm info using node@v6.3.0
[..................] - : info using node@v6.3.0
npm info lifecycle angular2-seed@0.0.0~prebuild.prod: angular2-seed@0.0.0
npm info lifecycle angular2-seed@0.0.0~build.prod: angular2-seed@0.0.0
> angular2-seed@0.0.0 build.prod /opt/atlassian/bitbucketci/agent/build
> gulp build.prod --color
[12:49:06] Requiring external module ts-node/register
/opt/atlassian/bitbucketci/agent/build/node_modules/ts-node/src/index.ts:280
        throw new TSError(diagnosticList)
              ^
TSError: ⨯ Unable to compile TypeScript
gulpfile.ts (1,23): Cannot find module 'gulp'. (2307)
gulpfile.ts (2,30): Cannot find module 'run-sequence'. (2307)
    at getOutput (/opt/atlassian/bitbucketci/agent/build/node_modules/ts-node/src/index.ts:280:15)
    at compile (/opt/atlassian/bitbucketci/agent/build/node_modules/ts-node/src/index.ts:289:14)
    at loader (/opt/atlassian/bitbucketci/agent/build/node_modules/ts-node/src/index.ts:304:23)
    at Object.require.extensions.(anonymous function) [as .ts] (/opt/atlassian/bitbucketci/agent/build/node_modules/ts-node/src/index.ts:321:14)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Liftoff.handleArguments (/opt/atlassian/bitbucketci/agent/build/node_modules/gulp/bin/gulp.js:116:3)
 
npm info lifecycle angular2-seed@0.0.0~build.prod: Failed to exec build.prod script
npm ERR! Linux 4.4.0-28-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build.prod"
npm ERR! node v6.3.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! angular2-seed@0.0.0 build.prod: `gulp build.prod --color`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the angular2-seed@0.0.0 build.prod script 'gulp build.prod --color'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp build.prod --color
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-seed
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-seed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /opt/atlassian/bitbucketci/agent/build/npm-debug.log

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Yves Candel July 20, 2016

Solved it!

This bitbucket-pipelines.yml worked:

# You can use a Docker image from Docker Hub or your own container
# registry for your build environment.
image: node:6.3.0

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - node --version
          - npm --version
          - npm install -g gulp ts-node typescript typings
          - npm install --unsafe-perm
          - npm run build.prod
Mugesh_Rajaram November 14, 2017

what is the use of --unsafe-perm

TAGS
AUG Leaders

Atlassian Community Events