mitre-attack / attack-navigator

Web app that provides basic navigation and annotation of ATT&CK matrices
https://mitre-attack.github.io/attack-navigator
Apache License 2.0
1.99k stars 590 forks source link

Can't startup from develop branch #70

Closed DpoBoceka closed 5 years ago

DpoBoceka commented 5 years ago

I tried to launch an app in develop branch because it has a feature I need about multiplied layers and got an error. I just cloned the branch and build it: git clone -b develop https://github.com/mitre/attack-navigator.git && npm install && npm rebuild node-sass --force

navigator    | > nav-app@1.0.0 start /opt/navigator/nav-appnavigator    | > ng serve --host 0.0.0.0
navigator    | 
navigator    | ** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **
navigator    | 
navigator    | Date: 2018-11-22T09:05:31.642Z
navigator    | Hash: d809ac90adf8d5df3853
navigator    | Time: 40944msnavigator    | chunk {main} main.js, main.js.map (main) 620 kB [initial] [rendered]
navigator    | chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 415 kB [initial] [rendered]
navigator    | chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]navigator    | 
navigator    | ERROR in ./node_modules/exceljs/dist/es5/csv/csv.js
navigator    | Module not found: Error: Can't resolve 'fs' in '/opt/navigator/nav-app/node_modules/exceljs/dist/es5/csv'
navigator    | ERROR in ./node_modules/exceljs/dist/es5/utils/utils.js
navigator    | Module not found: Error: Can't resolve 'fs' in '/opt/navigator/nav-app/node_modules/exceljs/dist/es5/utils'
navigator    | ERROR in ./node_modules/exceljs/dist/es5/xlsx/xlsx.js
navigator    | Module not found: Error: Can't resolve 'fs' in '/opt/navigator/nav-app/node_modules/exceljs/dist/es5/xlsx'
navigator    | ERROR in ./node_modules/fast-csv/lib/index.js
navigator    | Module not found: Error: Can't resolve 'fs' in '/opt/navigator/nav-app/node_modules/fast-csv/lib'
navigator    | ERROR in ./node_modules/fast-csv/lib/formatter/formatter.js
navigator    | Module not found: Error: Can't resolve 'fs' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/formatter'navigator    | ERROR in ./node_modules/fast-csv/lib/formatter/index.js
navigator    | Module not found: Error: Can't resolve 'fs' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/formatter'navigator    | ERROR in ./node_modules/fast-csv/lib/formatter/formatter_stream.js
navigator    | Module not found: Error: Can't resolve 'fs' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/formatter'navigator    | ERROR in ./node_modules/fast-csv/lib/parser/index.js
navigator    | Module not found: Error: Can't resolve 'fs' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/parser'navigator    | ERROR in ./node_modules/fast-csv/lib/parser/parser_stream.js
navigator    | Module not found: Error: Can't resolve 'fs' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/parser'navigator    | chunk {scripts} scripts.js, scripts.js.map (scripts) 2.18 MB  [rendered]
navigator    | ERROR in ./node_modules/fast-csv/lib/extended.js
navigator    | Module not found: Error: Can't resolve 'os' in '/opt/navigator/nav-app/node_modules/fast-csv/lib'navigator    | ERROR in ./node_modules/exceljs/dist/es5/utils/stream-buf.js
navigator    | Module not found: Error: Can't resolve 'stream' in '/opt/navigator/nav-app/node_modules/exceljs/dist/es5/utils'
navigator    | ERROR in ./node_modules/fast-csv/lib/formatter/formatter_stream.js
navigator    | Module not found: Error: Can't resolve 'stream' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/formatter'
navigator    | ERROR in ./node_modules/fast-csv/lib/formatter/formatter.js
navigator    | Module not found: Error: Can't resolve 'stream' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/formatter'
navigator    | ERROR in ./node_modules/fast-csv/lib/formatter/index.js
navigator    | Module not found: Error: Can't resolve 'stream' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/formatter'
navigator    | ERROR in ./node_modules/fast-csv/lib/parser/index.js
navigator    | Module not found: Error: Can't resolve 'stream' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/parser'
navigator    | ERROR in ./node_modules/fast-csv/lib/parser/parser_stream.js
navigator    | Module not found: Error: Can't resolve 'stream' in '/opt/navigator/nav-app/node_modules/fast-csv/lib/parser'
navigator    | ERROR in ./node_modules/jszip/lib/readable-stream-browser.js
navigator    | Module not found: Error: Can't resolve 'stream' in '/opt/navigator/nav-app/node_modules/jszip/lib'
navigator    | chunk {styles} styles.js, styles.js.map (styles) 202 kB [initial] [rendered]
navigator    | chunk {vendor} vendor.js, vendor.js.map (vendor) 8.61 MB [initial] [rendered]
navigator    | 
navigator    | WARNING in ./node_modules/sax/lib/sax.js
navigator    | Module not found: Error: Can't resolve 'stream' in '/opt/navigator/nav-app/node_modules/sax/lib'
navigator    | ℹ 「wdm」: Failed to compile.
isaisabel commented 5 years ago

Hi @DpoBoceka - I tried running a fresh clone of the develop branch on OSX 10.13.6 and it worked fine. Because of a webpack issue with fs, stream and os (the errors seen in your comment) there is now a postinstall step to apply a patch (from here). Postinstall should be run by npm automatically after calling npm install.

Maybe you have to run npm install as its own command, not joined by the double ampersand? Otherwise, could you provide us with your OS and node version (node -v)? Thanks!

isaisabel commented 5 years ago

Another possible cause is your npm rebuild step. This might have removed the postinstall patch.

DpoBoceka commented 5 years ago

Just tried again and after docker's up and get the same output. Dockerfile:

FROM node:alpine 

RUN apk add --no-cache git \
                       python2-dev \
                       g++ \
                       make \
                       build-base \
  && git clone -b develop https://github.com/mitre/attack-navigator.git /opt/navigator

WORKDIR /opt/navigator/nav-app/

RUN npm install 
  #&& npm rebuild node-sass --force

EXPOSE 4200

CMD npm start

And it worked well when I was using master branch.. The host OS is Centos 7.5.1804 (Core)

isaisabel commented 5 years ago

Hi @DpoBoceka - I managed to reproduce the bug using docker. Apparently the issue is that postinstall is not run automatically when docker runs npm install (see here). I added a fix and merged it into develop. Let me know if that clears up your issue.

DpoBoceka commented 5 years ago

Well, I just rebuild an image to get the updated branch and the error's the same. Or am I to do something more?

isaisabel commented 5 years ago

Could you please varify that you are on the current develop head (27a73a44a5e711a70002a4d0b7a3be8ed70eeed2)? If you are, does your Dockerfile contain the flag --unsafe-perm on the npm install step? The line in question should be RUN npm install --unsafe-perm && npm rebuild node-sass --force.

DpoBoceka commented 5 years ago

Everything seem to be fine now. Thank you!

mamarilr commented 4 years ago

what needs to be ugprade/updated on this error.

ARNING in /root/Downloads/attack-navigator-master/nav-app/src/environments/environment.prod.ts is part of the TypeScript compilation but it's unused. Add only entry points to the 'files' or 'include' properties in your tsconfig.

WARNING in /root/Downloads/attack-navigator-master/nav-app/src/app/app.module.ts depends on 'rxjs/add/operator/map'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in /root/Downloads/attack-navigator-master/nav-app/src/app/datatable/data-table.component.ts depends on 'is_js'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in /root/Downloads/attack-navigator-master/nav-app/src/app/datatable/data-table.component.ts depends on 'exceljs/dist/es5/exceljs.browser'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in /root/Downloads/attack-navigator-master/nav-app/node_modules/rxjs/Rx.js depends on 'rxjs-compat'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in /root/Downloads/attack-navigator-master/nav-app/node_modules/rxjs/observable/fromPromise.js depends on 'rxjs-compat/observable/fromPromise'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in /root/Downloads/attack-navigator-master/nav-app/node_modules/rxjs/add/operator/map.js depends on 'rxjs-compat/add/operator/map'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

isaisabel commented 4 years ago

Hi @mamarilr,

I'm not sure what you're asking here. Are you having issues running via docker on the develop branch? The Navigator has had significant changes since this issue was originally opened, so if you're having trouble with docker please open a new issue.