Skip to content
How do I import npm packages in javascript
Profile icon

I have imported the npm package i need via packages.json

Im doing this:
import { Fabric, c8ql } from "jsc8";

getting this error: Installing fresh packages evalmachine.<anonymous>:3 import {Fabric} from "jsc8"; ^ SyntaxError: Unexpected token { at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInContext (vm.js:284:10) at evaluate (/run_dir/repl.js:133:14) at ReadStream.<anonymous> (/run_dir/repl.js:116:5) at ReadStream.emit (events.js:189:13) at addChunk (_stream_readable.js:284:12) at readableAddChunk (_stream_readable.js:265:11) at ReadStream.Readable.push (_stream_readable.js:220:10) at (internal/fs/streams.js:181:12)
You are viewing a single comment. View All
Profile icon

In node.js:

  1. Go to side bar on the left side.
  2. Click on the second option, which is packages.
  3. Type the name of the module you are in need of.
  4. Click on the name when it appears in the list below.
  5. Click on the plus sign.

If this answer is correct, please check the checkmark on the left side of this message. Thanks and Good Luck!

Profile icon

Thanks very much - works now!

Profile icon

: Great to here that it is working! Could you please mark the answer as correct? Thanks!