Cant find module


#1

I ve been trying to load a theme from the git , given in the docs
i have followed the whole tutorial but there is an error i couldnt rectify that is " cant find module server/api " please help


#2

Can you be more specific about exactly what you did? There isn’t really enough info here to offer much advise.


#3

I have followed the tutorial of creating template in reaction commerce which is in the docs of the reaction commerce website , This is what i did
i am copying the client folder ( having index.js and a .less(styles) file in it ) in imports/plugins/custom folder and copying the registry.js in reaction folder and after that i did reaction reset . but there is an error of "cant find module server/api’ . could you help ?


#4

Seeing actual code would make it a lot easier to make a suggestion, but one thing that stands out from what you have said so far is that it should be "/server/api", not "server/api"


#5

yeah its /server/api but still couldnt resolve the error

this my register.js file present in reaction folder :
import { Reaction } from “/server/api”;

Reaction.registerPackage({
// Name of the theme for presentation purposes
label: “index”,

// Name of your theme to uniquely identify it from other themes
name: “index.js”
});

and there is client folder present in imports/plugins/custom folder having two files
index .js :
// Import CSS
import “./styles/main.less”;

and second one is is just main.less file .


#6

using import { Reaction } from "/lib/api"; worked for me.


#7

Hey! What made you decide to use this?

import { Reaction } from “/lib/api”;


#8

I tried this and it didn’t work for me. “/server/api” doesnt work either


#9

there was no /server/api folder, so I searched the files for import { Reaction } and found it being imported from /lib/api. tried it and it worked.