newrelic / nr1-account-maturity

NR1 Account Maturity is a quick view to understand if you're using key features of your New Relic account across multiple accounts and multiple applications.
Apache License 2.0
4 stars 12 forks source link

Can not serve it locally by following readme instruction #8

Open gem-wang opened 4 years ago

gem-wang commented 4 years ago

Because our account has application monitor including Prod, Test, and Dev. The maturity data is counted for all environments. We want to only count for Prod, so some modification needs to be made. I am trying to pull it down to my local and modify the query. But I got below error even during cloning:


npm ERR!
npm ERR! <!-- Copyright (C) M...'
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep npm ERR! Unexpected token < in JSON at position 4 while parsing near '
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! <!-- Copyright (C) M...'
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     C:\Users\wangh10\AppData\Roaming\npm-cache\_logs\2020-05-15T17_53_46_209Z-debug.log
npm ERR! prepareGitDep
Unhandled rejection Error: premature close
    at PassThrough.onclose (C:\Program Files\nodejs\node_modules\npm\node_modules\end-of-stream\index.js:47:67)
    at PassThrough.emit (events.js:187:15)
    at emitCloseNT (internal/streams/destroy.js:59:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)```
goldenplec commented 4 years ago

Can you clarify which command you've ran that yields that error. Is it the NR1 clone

nr1 nerdpack:clone -r https://github.com/newrelic/nr1-account-maturity.git

if so can you try a standard git clone https://github.com/newrelic/nr1-account-maturity.git

The reason it shows all is because there isn't anything guaranteed for us to hook into in ALL New Relic accounts that tells us if an account is production,staging, development and unfortunately account name isn't reliable in that way when we look at the broader New Relic customer base.

You totally could modify to filter to accounts matching a specific string or value and I believe we did include a string search function just above the row of accounts to allow you type a matching string like PROD in and filter what is seen.

Remember the goal here isn't to get an amazing score across all accounts it's to highlight unused features and functionalities and where something important might only be abled on portions of your applications to ensure full visibility across your estate.

gem-wang commented 4 years ago

Yes, I tried the nr1 nerdpack:clone** one. And I tried a standard one after that. It was showing me the same error when I did npm install

Good to know that I can add the matching string like PROD myself. Now I just need to get pass this error.

goldenplec commented 4 years ago

Very strange. A fresh clone here for myself and an npm install yielded success.

Anything unique about your setup. OS / npm or node version etc. Just for comparison as I can't replicate at the minute.

gem-wang commented 4 years ago

OS: windows 10. npm: 6.4.1. node: 10.15.0

Got a new error:


λ nr1 nerdpack:clone -r https://github.com/newrelic/nr1-account-maturity.git --force
Cloning repository...
Cloning into 'C:\devl\nr1-account-maturity'...
remote: Enumerating objects: 91, done.
remote: Counting objects: 100% (91/91), done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 91 (delta 23), reused 83 (delta 16), pack-reused 0
Unpacking objects: 100% (91/91), done.
Setting repo as remote upstream...
Installing dependencies...
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nr1-maturity@0.5.1 snyk-protect: `snyk protect`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the nr1-maturity@0.5.1 snyk-protect 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!     C:\Users\wangh10\AppData\Roaming\npm-cache\_logs\2020-05-19T14_33_51_138Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nr1-maturity@0.5.1 prepare: `npm run snyk-protect`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the nr1-maturity@0.5.1 prepare 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!     C:\Users\wangh10\AppData\Roaming\npm-cache\_logs\2020-05-19T14_33_51_333Z-debug.log
x  Error: Error on command: npm.cmd ci```
goldenplec commented 4 years ago

@LucyPilot interesting. Can replicate on Windows. I'm going to look into why this is happening for Windows alone but not Linux or Mac. Hopefully something simple. I'll get back you once I've got an update.

gem-wang commented 4 years ago

@goldenplec Sounds good! Thank you!

goldenplec commented 4 years ago

Hey @LucyPilot

First, apologies time has not been a friend lately. We think we have a solution. There's a PR on the dependency repository and when that's merged we think Windows or Linux either will build just fine.

In order to not hold you up further. Here's the logic.

This repo is the main nerdpack, to separate out logic for other projects to be able to make use of the same code. That repo is pulled in as a dependency when you npm install.

https://github.com/newrelic-experimental/nr1-account-maturity-products

As such you may want to clone this locally yourself in the same directory where the directory for this project exists.

cd nr1-account-maturity-products

Change line 11 of project.json to be babel -d dist src --delete-dir-on-start

This removes the linux command dependency and lets babel do the cleanup needed.

npm install
npm run build 

Now we move into the main nerdlet

cd ..
cd nr1-account-maturity
npm install
npm i --save ../nr1-account-maturity-products
// The above just points the dependency to the local repository you cloned instead of grabbing it live from github.
nr1 nerdpack:serve

This should let you

  1. Build successfully Windows or Linux
  2. Develop locally with the full codebase as this is where a lot of the calculations are happening

Hope that helps. Thanks so much for reporting it. We'll get the long term fix PR merged soon.

gem-wang commented 4 years ago

@goldenplec Thanks for getting back to me. I followed your steps. The first issue I had was that babel is not recognized as an internal or external command. Then I did npm install --save-dev babel-cli. After installing babel, I got below error

your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.
    at throwVersionError (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\@babel\helper-plugin-utils\lib\index.js:65:11)
    at Object.assertVersion (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\@babel\helper-plugin-utils\lib\index.js:13:11)
    at _default (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\@babel\plugin-proposal-class-properties\lib\index.js:13:7)
    at C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\@babel\helper-plugin-utils\lib\index.js:19:12
    at Function.memoisePluginContainer (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-core\lib\transformation\file\options\option-manager.js:113:13)
    at Function.normalisePlugin (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-core\lib\transformation\file\options\option-manager.js:146:32)
    at C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-core\lib\transformation\file\options\option-manager.js:184:30
    at Array.map (<anonymous>)
    at Function.normalisePlugins (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-core\lib\transformation\file\options\option-manager.js:158:20)
    at OptionManager.mergeOptions (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-core\lib\transformation\file\options\option-manager.js:234:36)
    at OptionManager.init (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
    at File.initOptions (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-core\lib\transformation\file\index.js:212:65)
    at new File (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-core\lib\transformation\file\index.js:135:24)
    at Pipeline.transform (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
    at transform (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-cli\lib\babel\util.js:50:22)
    at Object.compile (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-cli\lib\babel\util.js:59:12)
    at write (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-cli\lib\babel\dir.js:21:21)
    at handleFile (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-cli\lib\babel\dir.js:43:7)
    at C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-cli\lib\babel\dir.js:61:9
    at Array.forEach (<anonymous>)
    at handle (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-cli\lib\babel\dir.js:59:29)
    at Array.forEach (<anonymous>)
    at module.exports (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-cli\lib\babel\dir.js:69:15)
    at Object.<anonymous> (C:\devl\nr1-account-maturity\nr1-account-maturity-products\node_modules\babel-cli\lib\babel\index.js:129:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! maturity-products@1.0.0 build: `babel -d dist src --delete-dir-on-start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the maturity-products@1.0.0 build 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!     C:\Users\wangh10\AppData\Roaming\npm-cache\_logs\2020-06-19T17_00_14_905Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! maturity-products@1.0.0 prepare: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the maturity-products@1.0.0 prepare 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!     C:\Users\wangh10\AppData\Roaming\npm-cache\_logs\2020-06-19T17_00_15_017Z-debug.log

I tried to install/upgrade @babel/core, I still got the same error.

goldenplec commented 4 years ago

That's confusing. Babel is installed as a dependency so should work as long as npm install has been run in the dependency repo we cloned it shouldn't be rejecting babel.

Can you try the babel command with npx ahead of it. So

npx babel -d dist src --delete-dir-on-start

goldenplec commented 4 years ago

Oh and just on the off chance that in the node world I'm being too gung ho in just installing the local entry over the github one. We should probably do

cd ..
cd nr1-account-maturity
npm install
npm uninstall maturity-products
npm i --save ../nr1-account-maturity-products
nr1 nerdpack:serve
gem-wang commented 4 years ago

You can ignore the last error message I sent because I cloned the product repo inside of the account-maturity one. I changed it. Now I got this error after I run npm install

λ npm install

> nr1-maturity@0.5.1 prepare C:\devl\nr1-account-maturity
> npm run snyk-protect

> nr1-maturity@0.5.1 snyk-protect C:\devl\nr1-account-maturity
> snyk protect

write EPROTO 19936:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\ssl\record\ssl3_record.c:252:

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nr1-maturity@0.5.1 snyk-protect: `snyk protect`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the nr1-maturity@0.5.1 snyk-protect 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!     C:\Users\wangh10\AppData\Roaming\npm-cache\_logs\2020-06-22T17_44_52_948Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nr1-maturity@0.5.1 prepare: `npm run snyk-protect`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the nr1-maturity@0.5.1 prepare 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!     C:\Users\wangh10\AppData\Roaming\npm-cache\_logs\2020-06-22T17_44_53_117Z-debug.log