I have made a GitHub Action in a private repo:
import * as core from '@actions/core';
import * as github from '@actions/github';
async function run() {
try {
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message);
} else {
core.setFailed('Unknown error has occurred: ' + error);
}
}
}
run();
When I run this action from another private repo I get the following error:
Error: Cannot find module '@actions/core'
I don't get this error in Visual Studio Code, only when running the Action on GitHub.
All the modules are installed, I have even built into JS file but still get the error, and my TypeScript config is correct also. Any ideas?
Action:
name: 'Action'
description: 'GitHub Action.'
author: 'G'
inputs: {}
runs:
using: 'node16'
main: 'dist/main.js'
tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"outDir": "dist"
},
"include": ["./*.ts"],
"exclude": ["node_modules"]
}
You simply need to install the node package:
npm i @actions/core
Edit: do the same for @actions/github
, it'll error too
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With