NASA-SW-VnV / fret

A framework for the elicitation, specification, formalization and understanding of requirements.
Other
284 stars 50 forks source link

Installation on Mac M1 Monterey throwing webpack/native dependency errors #53

Closed yunaHwang closed 1 year ago

yunaHwang commented 1 year ago

Hi,

I am having trouble installing FRET on my M1 Mac. When running npm run fret-install, there seems to be a webpack issue that prohibits the dependencies from being installed. Below is the full error message generated.

npm run fret-install 

> fret@0.0.1 fret-install
> npm --prefix ../tools/LTLSIM/ltlsim-core install ../tools/LTLSIM/ltlsim-core && npm install

> ltlsim-core@1.0.0 install
> make -C "./simulator" && make -C "./simulator" clean

gcc -c -o ltlsim_commands.o ltlsim_commands.c -I. -g -Wall
gcc -c -o ltlsim_smvutils.o ltlsim_smvutils.c -I. -g -Wall
In file included from ltlsim_smvutils.c:2:
./ltlsim_smvutils_private.h:85:13: warning: unused function '_prepFormula' [-Wunused-function]
static void _prepFormula(char *f_expr, const char *expr);
            ^
1 warning generated.
gcc -c -o ltlsim_types.o ltlsim_types.c -I. -g -Wall
gcc ltlsim.c ltlsim_commands.o ltlsim_smvutils.o ltlsim_types.o -o ltlsim -I. -g -Wall
rm -f *.o

up to date, audited 11 packages in 506ms

found 0 vulnerabilities
npm WARN deprecated @types/puppeteer@7.0.4: This is a stub types definition. puppeteer provides its own type definitions, so you do not need this installed.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated trim@0.0.1: Use String.prototype.trim() instead
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated acorn-dynamic-import@2.0.2: This is probably built in to whatever tool you're using. If you still need it... idk
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated sane@2.5.2: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated samsam@1.3.0: This package has been deprecated in favour of @sinonjs/samsam
npm WARN deprecated extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated babel-eslint@8.2.6: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated electron-osx-sign@0.4.11: Please use @electron/osx-sign moving forward. Be aware the API is slightly different
npm WARN deprecated @babel/polyfill@7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated bfj-node4@5.3.1: Switch to the `bfj` package for fixes and new features!
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated svgo@0.7.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated electron-rebuild@1.11.0: Please use @electron/rebuild moving forward.  There is no API change, just a package name change
npm WARN deprecated @material-ui/styles@4.11.5: Material UI v4 doesn't receive active development since September 2021. See the guide https://mui.com/material-ui/migration/migration-v4/ to upgrade to v5.
npm WARN deprecated @material-ui/lab@4.0.0-alpha.61: Material UI v4 doesn't receive active development since September 2021. See the guide https://mui.com/material-ui/migration/migration-v4/ to upgrade to v5.
npm WARN deprecated highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated @material-ui/core@4.12.4: Material UI v4 doesn't receive active development since September 2021. See the guide https://mui.com/material-ui/migration/migration-v4/ to upgrade to v5.
npm WARN deprecated mdn-browser-compat-data@0.0.65: mdn-browser-compat-data is deprecated. Upgrade to @mdn/browser-compat-data. Learn more: https://github.com/mdn/browser-compat-data/blob/v1.1.2/UPGRADE-2.0.x.md

> fret@0.0.1 postinstall
> node -r babel-register internals/scripts/CheckNativeDep.js && npm run flow-typed && npm run build-dll && electron-builder install-app-deps && node node_modules/fbjs-scripts/node/check-dev-engines.js package.json

Webpack does not work with native dependencies.
@material-ui/core, @material-ui/icons, @material-ui/lab, antlr4, archiver, babel-plugin-flow-react-proptypes, classnames, command-exists, csvtojson, d3-svg-annotation, d3, devtron, ejs-compiled-loader, ejs, electron-debug, electron-is-dev, font-awesome, hex-to-rgba, history, html-loader, immutable, jest-each, jest-junit, ltlsim-core, mathjs, node-html-parser, node-uuid, product-iterable, raw-loader, react-color, react-dom, react-json-view, react-markdown, react-mathjax2, react-redux, react-router-dom, react-router-redux, react-router, react-stars, react, recharts, redux-thunk, redux, slate-history, slate-react, slate, source-map-support are native dependencies and should be installed inside of the "./app" folder.

First uninstall the packages from "./package.json":
npm uninstall your-package

Then, instead of installing the package to the root "./package.json":
npm install your-package --save

Install the package to "./app/package.json"
cd ./app && npm install your-package --save

Read more about native dependencies at:
https://github.com/chentsulin/electron-react-boilerplate/wiki/Module-Structure----Two-package.json-Structure

npm ERR! code 1
npm ERR! path /Users/yuna_hwang/Documents/Wisconsin/Research/resources/fret/fret-electron
npm ERR! command failed
npm ERR! command sh /var/folders/zd/dxn2cgtj5jsdnvh3nzcrnfw40000gn/T/postinstall-aa3336f3.sh

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yuna_hwang/.npm/_logs/2023-05-18T19_41_49_606Z-debug-0.log

Thanks in advance.

anmavrid commented 1 year ago

Hi @yunaHwang,

Thanks for your interest in FRET!

I see that it fails at npm run fret-install. What node version are you using? Also which version of FRET are you using? Is it the latest (v2.6.0)?

In general, for M1 architectures please follow the following steps after cloning FRET:

  1. cd fret/fret-electron
  2. npm run fret-install
  3. cd app (under fret/fret-electron/)
  4. npm install leveldown@latest
  5. Edit package-lock.json (under fret/fret-electron/app/)
  6. Change leveldown dependency: “^5.4.0” under node_modules/level to “^6.0.3”
  7. Change leveldown dependency: “5.6.0” under node_modules/pouchdb to “^6.0.3”
  8. cd ..
  9. npm start

Thanks, Anastasia

yunaHwang commented 1 year ago

Hi, @anmavrid thanks for the prompt response.

I am using v16.16.0 for node and my FRET version is v 2.6.0.

Thanks, Yuna

anmavrid commented 1 year ago

Thanks. Could you please send me the complete log?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yuna_hwang/.npm/_logs/2023-05-18T19_41_49_606Z-debug-0.log
yunaHwang commented 1 year ago

2023-05-18T19_41_49_606Z-debug-0.log

Here it is. The content is very long so here I send the entire file.

anmavrid commented 1 year ago

Thanks! It looks like this is due to the specific node version on M1 architectures.

Could you please try the following:

Downgrade to node version v16.15.1. The easiest way to do that is through nvm (node version manager). Just install nvm and then simply do nvm install 16.15.1.

Verify that you are running the correct node version (node --version)

Then do:

cd fret/fret-electron
npm run fret-reinstall

Notice that it is fret-reinstall and not fret-install in the above command.

Let me know if that works.

yunaHwang commented 1 year ago

2023-05-19T00_55_34_628Z-debug-0.log

Thanks for taking a look at that! I installed node v16.15.1. Unfortunately, this time there seems to be another issue. I attached the log.

yunaHwang commented 1 year ago

Update: it's working now! I did steps 3- 7 first and then ran npm fret-reinstall

3. cd app (under fret/fret-electron/)
4. npm install leveldown@latest
5. Edit package-lock.json (under fret/fret-electron/app/)
6. Change leveldown dependency: “^5.4.0” under node_modules/level to “^6.0.3”
7. Change leveldown dependency: “5.6.0” under node_modules/pouchdb to “^6.0.3”

Downgrading to a lower node version did help, all I had to fix was the leveldown package issue. Thanks for your help.

anmavrid commented 1 year ago

Great, Yuna!

I am closing this issue.

Anastasia