Open rhodey opened 3 years ago
Update: I switched my example to use v3.0.2
and the error went away, appears to be an issue introduced in 3.0.3
A couple of days ago I had the same problem, with Cannot find module './crypto_auth'
.
Looking a little deeper, and comparing the contents of the v3.0.3 package from npm, and cloning this project's repo locally. It looks very much as if the prepublish
script didn't get run before the package was published. At least manually running it creates ./crypto_auth.js
, and the package can be installed locally using npm i $(npm pack ../sodium-universal | tail -1)
and not get that error.
Also running into this.
Me too. I think it originates with this commit, to sodium-javascript:
https://github.com/sodium-friends/sodium-javascript/commit/656d6d251e88a6e139869f3e244c23a3ad91eeea
and this one in sodium-universal:
https://github.com/sodium-friends/sodium-universal/commit/e97357e4d280e9c04e6dc406e8c1cd38d5b8b462
A couple of days ago I had the same problem, with
Cannot find module './crypto_auth'
.Looking a little deeper, and comparing the contents of the v3.0.3 package from npm, and cloning this project's repo locally. It looks very much as if the
prepublish
script didn't get run before the package was published. At least manually running it creates./crypto_auth.js
, and the package can be installed locally usingnpm i $(npm pack ../sodium-universal | tail -1)
and not get that error.
Forgive me, where is the prepublish
script, and when should it normally be run? During build?
The prepublish
script is defined in package.json
.
It should be noted that the prepublish
script was deprecated in npm@5 and running npm install
in the cloned repo gives the warning:
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
With the version of npm that comes with Node 14.15.1, npm 6.14.9, it looks as prepublish
is treated as if it was prepare
. But, I see some comments that indicate that this might not have been the case with some versions of npm@6
Thanks to @paul90, I solved it like this.
Note I am not experienced at building node projects so perhaps this will break something somewhere else. But it worked for me:
yourPath/node_modules/sodium-universal/build-scripts
dirnode generate.js
The release of sodium-universal@3.0.4 should have resolved this issue.
Hello, I am running into this issue while trying to bundle hypercore for a web app. I have put together a minimal example project that fails to bundle with browserify. I have been trying to fix this myself but am not well experienced with browserify. Any help would be greatly appreciated, thank you.
https://github.com/rhodey/sodium-debug