jscad / OpenJSCAD.org

JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with JavaScript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
https://openjscad.xyz/
MIT License
2.66k stars 515 forks source link

Cannot find module 'openscad-openjscad-translator' #261

Closed Jip-Hop closed 7 years ago

Jip-Hop commented 7 years ago

Installed like this:

% git clone https://github.com/Spiritdude/OpenJSCAD.org
% cd OpenJSCAD.org
% make install

Node version: v6.10.0

Tried an example, but it failed with error:

converting example001.scad -> example001scad.jscad (OpenJSCAD.org Source)
module.js:471
    throw err;
    ^

Error: Cannot find module 'openscad-openjscad-translator'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/bin/openjscad:180:21)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Tried installing openscad-openjscad-translator like this: npm install @jscad/openscad-openjscad-translator

But still this error:

converting example001.scad -> example001scad.jscad (OpenJSCAD.org Source)
module.js:471
    throw err;
    ^

Error: Cannot find module 'openscad-openjscad-translator'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/bin/openjscad:180:21)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
kaosat-dev commented 7 years ago

Hi @Jip-Hop , sorry about that, it is now fixed ! If you get the latest dev version & reinstall it should work correctly

Jip-Hop commented 7 years ago

Thanks!

How do I install the dev branch to try it out? Also, how do I uninstall the previous installation? I'm on Mac OS X.

kaosat-dev commented 7 years ago

No problem ! simplest is : To uninstall : just delete the current OpenJSCAD.org folder and to reinstall

git clone https://github.com/jscad/OpenJSCAD.org
cd OpenJSCAD.org
git checkout dev
npm install

then you can run the local dev server if you want using :

npm run start-dev
Jip-Hop commented 7 years ago

Hmm seems I still have the same issue after following your instructions:

openjscad example001.scad -o example001scad.jscad
converting example001.scad -> example001scad.jscad (OpenJSCAD.org Source)
module.js:471
    throw err;
    ^

Error: Cannot find module 'openscad-openjscad-translator'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/bin/openjscad:180:21)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
kaosat-dev commented 7 years ago

oh wait, you are using it from the command line right ? my bad ! That would still reference the 'old' version ! I also found a bug, which is now fixed :)

so what you actually need is

npm install -g jscad/OpenJSCAD.org#dev

Sorry again !

Jip-Hop commented 7 years ago

Thanks! That's working now. But when I do the command to convert an OpenSCAD file: openjscad example001.scad -o example001scad.jscad and load the result in the browser I get the following error: ReferenceError: getParameterDefinitionsCLI is not defined

Seems that this piece of code is causing the error:

  var wrappedMain = main
  main = function(){
    var paramsDefinition = (typeof getParameterDefinitions !== 'undefined') ? getParameterDefinitions : undefined
    return wrappedMain(getParameterDefinitionsCLI(paramsDefinition, {}))
  }

After removing that piece the conversion works successfully. Thanks for the help.

kaosat-dev commented 7 years ago

Hmm that is weird, I might have an idea of what is causing it though: could you please include the whole resulting jscad file that fails here ?

Jip-Hop commented 7 years ago

This issue is solved. I've created a new one for the remaining problems here: #263.