Ask coding questions

← Back to all posts
How do I import npm packages in repl.it javascript
ChetanVenkatesh (0)

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

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

getting this error:

Repl.it: 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 lazyFs.read (internal/fs/streams.js:181:12)
Answered by vedprad1 (732) [earned 5 cycles]
View Answer
Commentshotnewtop
vedprad1 (732)

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!

ChetanVenkatesh (0)

@vedprad1 Thanks very much - works now!
Cheers!

vedprad1 (732)

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