Reputation: 1159
I have an issue trying to get my TS app to compile in a Bitbucket Pipeline.
Here's my .yaml file:
image: node:10.16.3
pipelines:
pull-requests:
'**':
- step:
name: Install dependencies
caches:
- node
script:
- npm install -g typescript
- npm install
- parallel:
- step:
name: Build App
caches:
- node
size: 2x
script:
- node -v && npm -v && tsc -v
- npm run build
- step:
name: Run Tests
caches:
- node
script:
- echo "Run tests"
However it fails with the following error:
bash: tsc: command not found
I've spend a long time Googling around to try to find the answer but I have had no luck getting past this issue. I tried and failed to overcome a few months ago, and today I looped back around to give it a shot but still no success.
Any help is duly appreciated. Thank you for your support
Upvotes: 0
Views: 2825
Reputation: 11
You have tsc: command not found
error because you install typescript in the first step, not the second step where you actually use it. Bitbucket pipelines don't automatically pass the environment to the next step. You can either:
artifact: node_modules
option in the first step. In which case, Bitbucket Pipelines will pass the whole node_modules
folder to the next step.npm install
directly in the step that needs it so you don't need to pass the node_modules
around.Another tip:
npm ci
for CI pipelines to prevent unexpected package updates.Upvotes: 1
Reputation: 2099
Based on your question and comment, there are two separate issues here:
tsc
, probably because its environment wasn't updated after the typescript
package was installed. I would suggest just leaving out the - node -v && npm -v && tsc -v
line permanently (or at least its && tsc -v
part), since any of those being missing would quickly show up when you try to - npm run build
anyway.size: 2x
for 8GB appears to be the most you can request right now, so you'll have to look at your build script for ways to reduce the memory footprint. Some ideas:
parallel
step in your pipeline config doesn't count, as that's using a separate VM.)Upvotes: 2