I have installed Ijavascript on linux pc
sudo npm install -g ijavascript
And i have installed the mathsteps
package
sudo npm install -g mathsteps
Now i try to open ijsnotebook
ijsnotebook
I started a javascript(node.js) shell
And now i am trying the following code example from https://github.com/google/mathsteps#usage
const mathsteps = require('mathsteps');
const steps = mathsteps.simplifyExpression('2x + 2x + x + x');
steps.forEach(step => {
console.log("before change: " + step.oldNode.toString()); // before change: 2 x + 2 x + x + x
console.log("change: " + step.changeType); // change: ADD_POLYNOMIAL_TERMS
console.log("after change: " + step.newNode.toString()); // after change: 6 x
console.log("# of substeps: " + step.substeps.length); // # of substeps: 3
});
I get this error:
internal/modules/cjs/loader.js:657
throw err;
^
Error: Cannot find module 'mathsteps'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:655:15)
at Function.Module._load (internal/modules/cjs/loader.js:580:25)
at Module.require (internal/modules/cjs/loader.js:711:19)
at require (internal/modules/cjs/helpers.js:14:16)
at evalmachine.<anonymous>:1:19
at Script.runInThisContext (vm.js:124:20)
at Object.runInThisContext (vm.js:314:38)
at run ([eval]:1054:15)
at onRunRequest ([eval]:888:18)
at onMessage ([eval]:848:13)
How can i solve this error. I want to check this code.
First I tried a global installation, and encountered same issue. However, after I did a local install, I don't have problem with declaring
const mathsteps = require('mathsteps');
anymore.In their repo, I have found an explanation written by the author:
You can find the whole conversation here: Set up working directory