register-dynamics / data-import

Components and patterns for building spreadsheet uploaders in digital services
https://register-dynamics.github.io/data-import/
1 stars 0 forks source link

Error running prototype in `/prototypes/basic` #8

Closed simonwo closed 3 months ago

simonwo commented 3 months ago

When I go into /prototypes/basic, run npm i and then npm run dev, I get:

Error: Cannot find module 'multer'
Require stack:
- /Users/simon/data-import/lib/importer/index.js
- /Users/simon/data-import/prototypes/basic/app/routes.js
- /Users/simon/data-import/prototypes/basic/node_modules/govuk-prototype-kit/lib/utils/index.js
- /Users/simon/data-import/prototypes/basic/node_modules/govuk-prototype-kit/server.js
- /Users/simon/data-import/prototypes/basic/node_modules/govuk-prototype-kit/listen-on-port.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1219:15)
    at Module._load (node:internal/modules/cjs/loader:1045:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Module.require (node:internal/modules/cjs/loader:1304:12)
    at require (node:internal/modules/helpers:123:16)
    at Object.<anonymous> (/Users/simon/data-import/lib/importer/index.js:1:16)
    at Module._compile (node:internal/modules/cjs/loader:1467:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1551:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
rossjones commented 3 months ago

Just to help debug, what happens if you first run npm i in /Users/simon/data-import/lib/importer/ ?

simonwo commented 3 months ago
% npm i

added 25 packages, and audited 26 packages in 466ms

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities
% cd -
% npm run dev
...
You can manage your prototype at:
http://localhost:3000/manage-prototype

The Prototype Kit is now running at:
http://localhost:3000

Looks like that works!

rossjones commented 3 months ago

I think because we are importing the importer as a local package it sees the already existing node_modules and doesn't import dependencies. I'll add a lib/importer npm -i in the makefile to make sure it's installed.