Jovo Could not resolve “vscode” error when I try to deploy

444 Views Asked by At

I’m trying to deploy my Jovo project to AWS Lambda using the command: “jovo deploy:code serverless” and I get “Could not resolve “vscode” error” at various locations in the node_modules folder.

Example:

X [ERROR] Could not resolve “vscode”`

node_modules/@alexa/acdl/dist/cjs/extension.js:30:27: 30 │ const vscode = require(“vscode”); ╵ ~~~~~~~~`

You can mark the path “vscode” as external to exclude it from the bundle, ``which will remove this error. You can also surround this “require” call with a try/catch block to handle this failure at run-time instead of bundle-time.`

X [ERROR] Could not resolve “vscode”`

node_modules/vscode-languageclient/lib/node/main.js:22:25: 22 │ const vscode_1 = require(“vscode”); ╵ ~~~~~~~~`

You can mark the path “vscode” as external to exclude it from the bundle, which will remove this error. You can also surround this “require” call with a try/catch block to handle this failure at run-time instead of `bundle-time.

I used “jovo build:serverless” to build the serverless.yaml file.

Any help is appreciated.

Thanks

Package.json file content:

{
  "name": "voice-controller",
  "private": true,
  "description": "test",
  "scripts": {
    "build": "babel src --out-dir dist",
    "start": "node dist/app.dev.js --jovo-webhook",
    "start:dev": "nodemon --watch src --exec \"babel src --out-dir dist && node dist/app.dev.js --jovo-webhook\"",
    "bundle:dev": "npm run bundle -- dist/app.dev.js",
    "prebundle": "rimraf bundle && babel src --out-dir dist",
    "bundle": "esbuild --bundle --outfile=bundle/index.js --sourcemap --minify --keep-names --platform=node --target=node16 --format=cjs  --external:aws-sdk --external:@oclif/* --external:@jovotech/cli*",
    "postbundle": "cd bundle && bestzip ../bundle.zip * && cd ..",
    "eslint": "eslint src test --fix",
    "test": "jest -c jest.config.js"
  },
  "author": "jovotech",
  "license": "Apache-2.0",
  "dependencies": {
    "@alexa/acdl": "^0.1.12",
    "@jovotech/db-dynamodb": "^4.2.13",
    "@jovotech/db-filedb": "^4.0.0",
    "@jovotech/framework": "^4.2.15",
    "@jovotech/platform-alexa": "^4.2.15",
    "@jovotech/platform-googleassistant": "^4.2.13",
    "@jovotech/plugin-debugger": "^4.2.14",
    "@jovotech/server-express": "^4.0.0",
    "@jovotech/target-serverless": "^4.1.6",
    "@types/vscode": "^1.67.0",
    "async": "^3.2.3",
    "esbuild-windows-64": "^0.14.40",
    "jovo-db-dynamodb": "^3.6.1",
    "jszip": "^3.10.0",
    "node-fetch": "^2.6.7",
    "vscode-languageclient": "^8.0.1",
    "vscode-test": "^1.6.1"
  },
  "devDependencies": {
    "@babel/cli": "^7.14.5",
    "@babel/core": "^7.14.6",
    "@babel/eslint-parser": "^7.16.3",
    "@babel/plugin-proposal-decorators": "^7.14.5",
    "@babel/plugin-transform-runtime": "^7.14.5",
    "@babel/preset-env": "^7.14.7",
    "@babel/register": "^7.14.5",
    "@babel/runtime": "^7.14.6",
    "@jovotech/cli-command-build": "^4.1.6",
    "@jovotech/cli-command-deploy": "^4.1.6",
    "@jovotech/cli-command-get": "^4.1.6",
    "@jovotech/cli-command-new": "^4.1.6",
    "@jovotech/cli-command-run": "^4.1.7",
    "@jovotech/cli-core": "^4.0.0",
    "@jovotech/filebuilder": "^0.0.1",
    "babel-jest": "^27.0.6",
    "bestzip": "^2.2.0",
    "esbuild": "^0.14.2",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^7.1.0",
    "eslint-plugin-prettier": "^3.3.1",
    "jest": "^26.6.3",
    "nodemon": "^2.0.10",
    "prettier": "^2.2.1",
    "rimraf": "^3.0.2"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/jovotech/jovo-framework.git"
  },
  "bugs": {
    "url": "https://github.com/jovotech/jovo-framework"
  },
  "homepage": "https://github.com/jovotech/jovo-v4-template-js/issues#readme"
}
0

There are 0 best solutions below