felixhao28 / JSCPP

A simple C++ interpreter written in JavaScript
https://felixhao28.github.io/JSCPP/
MIT License
861 stars 72 forks source link

Mac npm install error #80

Closed binchen1998 closed 4 years ago

binchen1998 commented 4 years ago

Hi,

On my mac os, after checking out and npm install, it shows the errors:

`Running "browserify:dist" (browserify) task

Error: Can't walk dependency graph: Cannot find module './ast' from '/Users/binchen/git/JSCPP/lib/launcher.js' required by /Users/binchen/git/JSCPP/lib/launcher.js Warning: Error running grunt-browserify. Use --force to continue.

Aborted due to warnings. npm ERR! code ELIFECYCLE npm ERR! errno 6 npm ERR! JSCPP@2.0.8 prepublish: grunt build npm ERR! Exit status 6 npm ERR! npm ERR! Failed at the JSCPP@2.0.8 prepublish script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/binchen/.npm/_logs/2020-10-20T00_39_14_925Z-debug.log `

Can you take a look? Thanks.

2020-10-20T00_39_14_925Z-debug.log

binchen1998 commented 4 years ago

Update: after I re-run the npm install, seems the build is successful, but open demo/index.html it shows: TypeError: JSCPP.run is not a function

The prior error is caused by ast.js and prepast.js is inside src/ but not lib/. However the other file requires them to be in lib/.(seems like order of the build script is broken). When second run ast.js and prepast.js are already copied to lib/, so the build is successful.

But seems like the result bundle file is still not right.

binchen1998 commented 4 years ago

Update: On Windows the error is exactly the same.

felixhao28 commented 4 years ago

I recently rewrote the whole project with TypeScript and that might have broken something. While I am working on a fix, you can use the previously built file.

felixhao28 commented 4 years ago

It actually turns out to be a very trivial problem. @binchen1998 try again and it should be fixed.

binchen1998 commented 4 years ago

Hi, thanks for your reply. The build is ok now, but the result file still has problem.

TypeError: Cannot read property 't' of undefined

Thanks.

binchen1998 commented 4 years ago

Detailed info: Uncaught TypeError: Cannot read property 't' of undefined at JSCPP.es5.min.js:1 at JSCPP.es5.min.js:1 at Object.next (JSCPP.es5.min.js:1) at JSCPP.es5.min.js:1 at Object.next (JSCPP.es5.min.js:1) at JSCPP.es5.min.js:1 at Object.next (JSCPP.es5.min.js:1) at JSCPP.es5.min.js:1 at Object.next (JSCPP.es5.min.js:1) at JSCPP.es5.min.js:1

rodrigorgs commented 4 years ago

TypeError: Cannot read property 't' of undefined

Same here, using Node v12.19.0 on macOS.

felixhao28 commented 4 years ago

It was a browserify lacking babel-polyfill issue. I don't know why it wasn't an issue earlier. Anyway, it is fixed now. @binchen1998 @rodrigorgs

binchen1998 commented 4 years ago

Thanks. It's ok now!