Jul 31, 2024 04:18 AM - edited Jul 31, 2024 04:46 AM
Hi, I used the HelloWorld TypeScript example, installed and imported the @octokit/rest package to interact with GitHub and now I get the following error. The module is @octokit/rest present in the node_modules, vscode uses types from the package OK.
Is there some caveat on using third party NPM modules?
Running NodeJS 14 (per docs) and @airtable/blocks 1.18.1
$ block run --http
Updating bundle...
Bundle Error: Cannot find module '@octokit/rest' from '/workspaces/airtable-run-github-workflow/build/development/transpiled/user/frontend'
Your block is running locally at http://localhost:9000
Aug 09, 2024 02:13 AM - edited Aug 09, 2024 09:33 PM
@smallhillcz wrote:Hi, I used the HelloWorld TypeScript example, installed and imported the @octokit/rest package to interact with GitHub and now I get the following error. The module is @octokit/rest present in the node_modules, vscode uses types from the package OK. Lowes Life
Is there some caveat on using third party NPM modules?
Running NodeJS 14 (per docs) and @airtable/blocks 1.18.1
$ block run --http
Updating bundle...
Bundle Error: Cannot find module '@octokit/rest' from '/workspaces/airtable-run-github-workflow/build/development/transpiled/user/frontend'
Your block is running locally at http://localhost:9000
Hello,
It sounds like you’re encountering a common issue with module resolution in your project. Here are a few steps to troubleshoot and resolve the problem:
Check Installation: Ensure that @octokit/rest is correctly installed in your project. Run:
npm install @octokit/rest
Verify Node Modules: Sometimes, the node_modules folder can get corrupted. Try deleting it and reinstalling all dependencies:
rm -rf node_modules
npm install
Check Path: Ensure that the path to the module is correct and that there are no typos in the import statement:
import { Octokit } from '@octokit/rest';
Update Dependencies: Make sure all your dependencies are up to date. Sometimes, compatibility issues can cause such errors:
npm update
Check Build Configuration: Ensure that your build configuration (e.g., Webpack, Babel) is correctly set up to handle third-party modules.
Clear Cache: Sometimes, clearing the npm cache can help resolve issues:
npm cache clean --force
Compatibility Issues: Verify that there are no compatibility issues between @octokit/rest, Node.js 14, and @airtable/blocks. Check the documentation and GitHub issues for any known problems.
Hope this will help you.
Best regards,
florence023