altangent / ccxws

WebSocket client for 38 cryptocurrency exchanges
MIT License
619 stars 186 forks source link

Invalid "main" entry / Missing index.js file #298

Closed mrfusi0n closed 2 years ago

mrfusi0n commented 2 years ago

Error: Cannot find module '/node_modules/ccxws/src/index.js'. Please verify that the package.json has a valid "main" entry

The ccxws package.json file has the line: "main": "src/index.js", but this file doesn't exist.

I believe you need to either include your dist folder in git or at least export your index.js, index.js.map, and index.d.ts from your dist folder.

Attached is my tiny sample project to reproduce the issue. Just needs npm install and then npm start sample.zip

mrfusi0n commented 2 years ago

My workaround for now is to navigate to node_modules/ccxws, do an npm install, and tsc to build the dist folder. Then, I modified the "main" entry in the package.json to "main": "dist/src/index.js". After this, my project works and is able to use ccxws.

bmancini55 commented 2 years ago

This should be fixed with the completed TypeScript release: https://github.com/altangent/ccxws/releases/tag/v0.46.1

Thanks!