facebookarchive/fbctf

NPM error when try to build dev environment

Closed this issue ยท 15 comments

HEAD version 3047351

It is happening both with the manual, vagrant and docker builds.

Following the default steps on README, using Mac OS Sierra as the development machine, I got the following NPM error:

(supressed the beggining of the input, as everything working as expected so far)
[+] Installing ca-certificates
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
[+] Installing npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
npm is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
[+] Updating npm

/usr/local/lib/node_modules/npm/lib/config/cmd-list.js:113
module.exports.aliases = Object.assign({}, shorthands, affordances)
                                ^
TypeError: Object function Object() { [native code] } has no method 'assign'
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/config/cmd-list.js:113:33)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /usr/local/lib/node_modules/npm/lib/npm.js:37:17
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/npm.js:471:3)
    at Module._compile (module.js:456:26)

I'm having the same issue on Ubuntu 14 with the current code, and previous code.

@wisco24 Do you remember the last build that was working?

I think it has to do with a new version of a dependency.

There is a PR almost complete, just doing some final testing.

@stevcoll If you want us to test the PR, let us know \o/

@stevcoll same as Ayrton, let me know if I can help with anything or testing, I need to run a deploy tonight so this is going to help a lot! thanks.

I banged my head on this one for a bit. Seems like a dependency issue in the provision.sh script. I commented out

#package npm
log "Updating npm
#sudo npm install -g npm@lts

#package nodejs-legacy

and added

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Nodejs will install npm as well. Seemed to fix the issue.

@ayr-ton / @wisco24 / @juanrossi / All:

The update to fix this issue has been submitted as a PR against dev. Sorry for the delay. If you are in need of a new deployment before the PR hits master, please feel free to locally merge the changes or use the branch containing the fix.

Branch: https://github.com/WraySec/fbctf/tree/bug_fixes / Commit: WraySec/fbctf@fae49641b9661f0ec4081848655604de7e0f89a4

@skcollins:

Thank you for looking into this, your fix is fairly close the fix that we implemented. The only differences are keeping the initial npm install and purging the legacy package before updating to the newest version.

Thanks everyone. @justinwray I think to prevent this type of issues in the future it would be best to install specific versions con npm modules, nodejs, etc.

It requires a little more work to test and update versions, but it would help.

Maybe switch to using Yarn? https://yarnpkg.com/lang/en/docs/yarn-lock/ (like npm-shrinkwrap but reproducible)

@ayr-ton @juanrossi Could one of you test the changes on Vagrant if you get a chance? Having some issues with my environment here.

@stevcoll I'll try to test it locally. I'm using Docker and the fix worked perfectly.

@juanrossi Great! I tested it on all other provision modes except for manual separate servers, which should be fine since the services are just broken out.

This issue has been resolved in PR #551 and merged into dev.

We will merge this fix into the master branch as soon as we finish testing and reviewing PR #555 so that they may both be included.

Confirmed that the last two PRs has fixed the issue.