Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

NPM error when try to build dev environment #550

Closed
ayr-ton opened this issue Aug 24, 2017 · 15 comments · Fixed by #559
Closed

NPM error when try to build dev environment #550

ayr-ton opened this issue Aug 24, 2017 · 15 comments · Fixed by #559

Comments

@ayr-ton
Copy link

ayr-ton commented Aug 24, 2017

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)
@wisco24
Copy link
Contributor

wisco24 commented Aug 24, 2017

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

@ayr-ton
Copy link
Author

ayr-ton commented Aug 24, 2017

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

@wisco24
Copy link
Contributor

wisco24 commented Aug 24, 2017

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

@stevcoll
Copy link

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

@ayr-ton
Copy link
Author

ayr-ton commented Aug 24, 2017

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

@juanrossi
Copy link
Contributor

@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.

@skcollins
Copy link

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.

@justinwray
Copy link
Contributor

@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.

@juanrossi
Copy link
Contributor

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.

@fredemmott
Copy link
Contributor

fredemmott commented Aug 25, 2017

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

@stevcoll
Copy link

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

@juanrossi
Copy link
Contributor

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

@stevcoll
Copy link

@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.

justinwray added a commit that referenced this issue Aug 28, 2017
* Remove NodeJS-Legacy (Fixes: #550)

* Updated version of node.js installed to fix critical provisioning errors. By default, Ubuntu 14.04 uses a legacy version of node.js. This code removes the legacy version and updates to a newer version.

* Source: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

* This PR fixes the provision/build issue from #550
@justinwray
Copy link
Contributor

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.

justinwray added a commit that referenced this issue Aug 31, 2017
…ixes: #554) (#555)

* Downgraded Dropkick.js to version 2.1.10.  The project originally was built using 2.1.10 and specified a near version in the 2.x.x release family.  On August 27th 2017 Dropkick.js released version 2.2.0 which is incompatible with ES6 specs. The incompatibility with the new release of Dropkick.js caused the provisioning of the platform to fail.

* Moved the installation process for Node.js to a function within `lib.sh`.  This change streamlines the provision script.

* Removed the installation of `wget` from provisioning.  `wget` is no longer used within the project and is therefore unneeded.

* Updated the `dl()` download function within the provision script to use `curl` exclusively, with retry options.  The retry options are set to 5 retries with a 15-second delay between retries.  The addition of the retry option ensures the provision can continue if there is a temporary issue with a remote connection or availability of a remote resource.

* Added the `dl_pipe()` download function to the provision script.  This download function provided the data from the remote resource via standard output to be piped into another command.  As piping downloads within the provisioning process have become more common, this function streamlines the process.

* Fixes #554

* Updates fixes for #550
@ayr-ton
Copy link
Author

ayr-ton commented Aug 31, 2017

Confirmed that the last two PRs has fixed the issue.

@ayr-ton ayr-ton closed this as completed Aug 31, 2017
justinwray added a commit that referenced this issue Sep 1, 2017
* Remove NodeJS-Legacy (Fixes: #550)

* Updated version of node.js installed to fix critical provisioning errors. By default, Ubuntu 14.04 uses a legacy version of node.js. This code removes the legacy version and updates to a newer version.

* Source: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

* This PR fixes the provision/build issue from #550
justinwray added a commit that referenced this issue Sep 1, 2017
…ixes: #554) (#555)

* Downgraded Dropkick.js to version 2.1.10.  The project originally was built using 2.1.10 and specified a near version in the 2.x.x release family.  On August 27th 2017 Dropkick.js released version 2.2.0 which is incompatible with ES6 specs. The incompatibility with the new release of Dropkick.js caused the provisioning of the platform to fail.

* Moved the installation process for Node.js to a function within `lib.sh`.  This change streamlines the provision script.

* Removed the installation of `wget` from provisioning.  `wget` is no longer used within the project and is therefore unneeded.

* Updated the `dl()` download function within the provision script to use `curl` exclusively, with retry options.  The retry options are set to 5 retries with a 15-second delay between retries.  The addition of the retry option ensures the provision can continue if there is a temporary issue with a remote connection or availability of a remote resource.

* Added the `dl_pipe()` download function to the provision script.  This download function provided the data from the remote resource via standard output to be piped into another command.  As piping downloads within the provisioning process have become more common, this function streamlines the process.

* Fixes #554

* Updates fixes for #550
justinwray added a commit that referenced this issue Sep 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants