dra2020 / dra-analytics

The analytics used in DRA consolidated in one place.
MIT License
1 stars 1 forks source link

npm ERR! 404 Not Found - GET https://registry.npmjs.org/@dra2020/topojson-simplify/-/topojson-simplify-3.0.102.tgz #6

Closed rootsmusic closed 2 years ago

rootsmusic commented 2 years ago

I'm a novice in Bash, Git, node and npm. I followed the instructions to run dra-analytics-app. Why do I get an error when I run npm? Thanks!

Steps in Git Bash:

  1. cd ~/Documents/GitHub/vtd_data/
  2. git clone https://github.com/dra2020/dra-analytics
  3. cd ~/Documents/GitHub/vtd_data/dra-analytics
  4. git pull says "already up to date".
  5. npm install (attached log) returns the error:

    npm WARN config global --global, --local are deprecated. Use --location=global instead. npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN deprecated text-encoding@0.6.4: no longer maintained npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information. npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/@dra2020/topojson-simplify/-/topojson-simplify-3.0.102.tgz - Not found npm ERR! 404 npm ERR! 404 '@dra2020/topojson-simplify@https://registry.npmjs.org/@dra2020/topojson-simplify/-/topojson-simplify-3.0.102.tgz' is not in this registry.

  6. npm run build returns the error:

    npm WARN config global --global, --local are deprecated. Use --location=global instead.

    @dra2020/dra-analytics@4.0.0 build webpack

    [webpack-cli] Failed to load 'C:\Users\admin\Documents\GitHub\vtd_data\dra-analytics\webpack.config.js' config [webpack-cli] Error: ENOENT: no such file or directory, scandir 'node_modules' at Object.readdirSync (node:fs:1441:3) at Object. (C:\Users\admin\Documents\GitHub\vtd_data\dra-analytics\webpack.config.js:6:4) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Module._load (node:internal/modules/cjs/loader:827:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at WebpackCLI.tryRequireThenImport (C:\Users\admin\node_modules\webpack-cli\lib\webpack-cli.js:204:22) at loadConfigByPath (C:\Users\admin\node_modules\webpack-cli\lib\webpack-cli.js:1404:38) { errno: -4058, syscall: 'scandir', code: 'ENOENT', path: 'node_modules' }

  7. cd ~/Documents/GitHub/vtd_data/
  8. git clone https://github.com/dra2020/dra-analytics-app
  9. cd ~/Documents/GitHub/vtd_data/dra-analytics-app
  10. git pull says "already up to date".
  11. npm install returns same error as in step 5.
  12. npm run test returns the error:

    npm WARN config global --global, --local are deprecated. Use --location=global instead.

    @alecramsay/redistricting-research@1.0.0 test node server

    node:internal/modules/cjs/loader:942 throw err;

    Error: Cannot find module './dist/server.bundle.js' Require stack:

    • C:\Users\admin\Documents\GitHub\vtd_data\dra-analytics-app\server.js at Module._resolveFilename (node:internal/modules/cjs/loader:939:15) at Module._load (node:internal/modules/cjs/loader:780:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (C:\Users\admin\Documents\GitHub\vtd_data\dra-analytics-app\server.js:1:11) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Module._load (node:internal/modules/cjs/loader:827:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\Users\admin\Documents\GitHub\vtd_data\dra-analytics-app\server.js' ] } Node.js v18.3.0

Versions: Desktop: Windows 10 Git: 2.36.1.windows.1 nvm for Windows: 1.1.9 Node.js: 18.3.0 npm: 8.11.0 2022-06-16T01_50_17_426Z-debug-0.log

alecramsay commented 2 years ago

Hey, sorry for the delay--this notification looked like spam at first.

It maybe easier if you email alec@davesredistricting.org.

For now, it looks like npm isn't installing for some reason (Step 5). I couldn't really say why that is. Have you searched for those error messages?

rootsmusic commented 2 years ago

npm is installed via nvm for Windows because npm -v shows "8.11.0". Where's the file at https://registry.npmjs.org/@dra2020/topojson-simplify/-/topojson-simplify-3.0.102.tgz ? Thanks.

alecramsay commented 2 years ago

Ah, sorry. That appears to be private.

Let me investigate making it public.

alecramsay commented 2 years ago

Sorry for the delay.

Give this a try again now. That npm package should be public now.

rootsmusic commented 2 years ago

@alecramsay Please also make https://registry.npmjs.org/@dra2020/baseclient/-/baseclient-1.0.67.tgz public.

alecramsay commented 2 years ago

Ugh, sorry.

You're the first person outside DRA to try this, and you're running into things that I don't as an insider.

Let me try to proactively figure out what all else needs to be made public and make it so.

alecramsay commented 2 years ago

Still checking whether we can definitively know in advance that all the dependencies are public, but in the meantime this one should be public too so give it a try.

rootsmusic commented 2 years ago

Yea, npm install works for dra-analytics! It returns the following message:

npm WARN config global --global, --local are deprecated. Use --location=global instead. npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN deprecated text-encoding@0.6.4: no longer maintained npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.

added 678 packages, and audited 679 packages in 1m

69 packages are looking for funding run npm fund for details found 0 vulnerabilities

rootsmusic commented 2 years ago

@alecramsay npm isn't working in dra-analytics-app. (Since it's related to a dependency file, I won't open another issue in https://github.com/terrencecrowley/chronology .) Please make https://registry.npmjs.org/@dra2020/dra-types/-/dra-types-1.8.57.tgz public.

alecramsay commented 2 years ago

I removed that dependency, as it wasn't needed. LMK if you run into any more problems. Very cool that you're doing this!

Out of curiosity, what are you going to do?

alecramsay commented 2 years ago

Note: Pull the latest from GitHub, to pick up the changes.

rootsmusic commented 2 years ago

@alecramsay Please also make https://registry.npmjs.org/@dra2020/baseserver/-/baseserver-1.0.33.tgz public. I'm checking out the partisan analytics in the app.

alecramsay commented 2 years ago

Ack! Sorry. We'll get this figured out. Appreciate you being the guinea pig.

alecramsay commented 2 years ago

OK, that npm package is now public. Hopefully everything should work now!

Again, I apologize that this has taken a few turns of the crank. We've had a lot of our code public for a long time for transparency, but nothing fully standalone executable until these two repos, so we're still working out the kinks. Appreciate the bushwhacking :-).

rootsmusic commented 2 years ago

The good news is npm install works and returns the following message:

67 packages are looking for funding run npm fund for details

3 vulnerabilities (1 moderate, 2 high) To address all issues, run: npm audit fix

alecramsay commented 2 years ago

Oy, sorry. I'll look into this ...

alecramsay commented 2 years ago

After pulling the latest from GitHub for dra-analytics-app, you need to run these 3 commands:

$ npm install
$ npm run build
$ npm run test

For some reason, the instructions omitted the first two -- I'll fix that -- though it looks like you did the install. You have to build as well, and then you should be able to start the server. (It's a much cut down clone of the main DRA client app & server.)

LMK if that does / doesn't work for you.

alecramsay commented 2 years ago

Sheez. I apologize for just how many things don't work outside the DRA team. Let me look into this ...

alecramsay commented 2 years ago

Is everything working for you now?

rootsmusic commented 2 years ago

No @alecramsay, I did git pull and npm run test still produces the error:

0: info: Mode: DEVELOPMENT: running against development DynamoDB databases and S3 buckets Listening on port 3000 Started server at 2022-06-22T17:40:11.945Z 1: info: Listening on port 3000 2: info: Started server at 2022-06-22T17:40:11.945Z dynamodb: listTables error: {"message":"Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1","code":"CredentialsError","time":"2022-06-22T17:40:21.012Z","retryable":true,"originalError":{"message":"Could not load credentials from any providers","code":"CredentialsError","time":"2022-06-22T17:40:21.012Z","retryable":true,"originalError":{"message":"EC2 Metadata roleName request returned error","code":"TimeoutError","time":"2022-06-22T17:40:21.011Z","retryable":true,"originalError":{"message":"Socket timed out without establishing a connection","code":"TimeoutError","time":"2022-06-22T17:40:21.011Z","retryable":true}}}} 3: error: dynamodb: listTables: {"message":"Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1","code":"CredentialsError","time":"2022-06-22T17:40:21.012Z","retryable":true,"originalError":{"message":"Could not load credentials from any providers","code":"CredentialsError","time":"2022-06-22T17:40:21.012Z","retryable":true,"originalError":{"message":"EC2 Metadata roleName request returned error","code":"TimeoutError","time":"2022-06-22T17:40:21.011Z","retryable":true,"originalError":{"message":"Socket timed out without establishing a connection","code":"TimeoutError","time":"2022-06-22T17:40:21.011Z","retryable":true}}}} DB failed to open. Exiting.

alecramsay commented 2 years ago

Oh, right--sorry. I saw your question about vtd_data and forgot have a question out myself about how to resolve the issue above. I believe I know what's going on but not (yet) how to resolve it for you. I'll let you know when we do.

alecramsay commented 2 years ago

OK, this will be more involved to address. It'll probably be a few days before I can get back to you with it resolved.

Thanks for your patience.

alecramsay commented 2 years ago

OK, my amazing colleague, Terry, was able to fix this problem quicker than I expected.

Please:

git pull
npm install
npm run build
npm run test

Then the server should be running and you can open a browser window and point it at localhost:3000. LMK how this goes.

Thanks again for your patience and for working out the kinks in this! My bad for not catching them to begin with.

rootsmusic commented 2 years ago

Good job, @terrencecrowley! There's no sample data set though, other than the example that doesn't have any district identifier. So I'll have to convert a file in https://github.com/dra2020/vtd_data/tree/master/2020_VTD to percentages. Am I limited to selecting a statewide office where there wasn't any third-party candidate (excluding write-in candidates)?

alecramsay commented 2 years ago

w00t! Thanks for persevering.

As noted in this Medium post, the app takes a partisan profile (JSON) of the form:

{
  "statewide": 0.515036,
  "byDistrict": [
    0.423500,
    0.428588,
    0.433880,
    0.443866,
    0.454505,
    0.456985,
    0.458005,
    0.458134,
    0.463947,
    0.473144,
    0.718314,
    0.736620,
    0.775817
  ]
}

There aren't any district ids or labels--just two-party Democratic vote shares by district. The election you choose to use can have 3rd-party votes in them--most do--you just need to convert them two the two-party Democratic share. This, of course, ignores the 3rd-party votes. All the analytics analyze two-parties, so pick your election accordingly.

Since issue this is now solved, I'm going to close it. Please send questions & comments to our feedback email alias.