0
votes

Starting a new project, I've installed the latest versions of webpack and webpack-dev-server. I've added the webpack-dev-server command to my start script in my package.json. Oddly, the dev server was working the first time I ran the project, but I then blew away my node_modules folder and reinstalled. Since reinstalling I am continually blocked by the following missing dependency error.

npm start

> webpack-dev-server

module.js:442
    throw err;
    ^

Error: Cannot find module 'hpack.js'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/a6001382/analytics/analytics-q/node_modules/spdy-transport/lib/spdy-transport/protocol/http2/hpack-pool.js:5:13)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)

spdy-transport seems to be the culprit, but I am still getting the error even after explicitly running "npm install" on spdy-transports root, and ensuring that "hpack.js" exists.

Has anyone else experienced this missing dependency?

1

1 Answers

3
votes

Resolved by running npm i -g npm@latest-4. Some versions of NPM don't correctly set the "main" field of package.json if the package contains a period.