LoginSignup
1
1

More than 1 year has passed since last update.

nexeでNode.jsのアプリをパッケージングしようとしたらNode.jsのバージョンで怒られた

Posted at

nexeでNode.jsのアプリをパッケージングしようとしたらNode.jsのバージョンで怒られた

久しぶりにNode.jsのアプリのパッケージングで、exeファイル作ろうとしてみたらエラーで怒られたので回避策を掲載しておきます。

私の環境(ERROR再現時)

  • Windows 10
  • nvm-windows で node.js のバージョン管理
  • node.js : v14.17.0
  • npm : v6.14.13

結論

nexeのv3.3.3でリリースしている、リストの一覧からnode.jsのバージョンを合わせないといけいない。
windows環境なら、windows-x64-14.15.3なので、node.jsのバージョンは、v14.15.3にする。

nexe の github releases
nexe releases windows-x64-14.15.3

以下はERROR遭遇から解決までの流れ

nexeでパッケージングしようとするとこんなエラーが出た

PS> npm run package

> hogehoge@1.0.0 package nexe index.js
> nexe index.js
i nexe 3.3.7
 Downloading pre-built Node.js
 Finished in 1.835s

Error: https://github.com/nexe/nexe/releases/download/v3.3.3/windows-x64-14.17.0 is not available, create it 
using the --build flag

See nexe -h for usage..

npm ERR! errno 1
npm ERR! hogehoge@1.0.0 package: `nexe index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hogehoge@1.0.0 package script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\{user}\AppData\Roaming\npm-cache\_logs\2021-05-29T14_03_17_600Z-debug.log
v14.17.0

// npm run package は「nexe index.js」を実行してるだけ。pacakge.jsonに記載してたので。。

nexe のリリースを確認するとnode.jsのv14.17.0に相当するものがなかった。

リリース一覧のうち最新のnode.jsのバージョンに、ローカル環境のnode.jsバージョンを合わせる。

windows-x64-14.15.3が最新っぽいので、ローカル環境をv14.15.3に更新。

PS> nvm install 14.15.3
Downloading node.js version 14.15.3 (64-bit)...
Complete
Creating C:\Users\{user}\AppData\Roaming\nvm\temp

Downloading npm version 6.14.9... Complete
Installing npm v6.14.9...

Installation complete. If you want to use this version, type

nvm use 14.15.3
PS> nvm use 14.15.3
Now using node v14.15.3 (64-bit)
PS> node -v
v14.15.3

再度パッケージングを試す

PS> npm run package

> hogehoge@1.0.0 package C:\project\hogehoge
> nexe index.js

i nexe 3.3.7
 Downloading...100%
 Compiling result
 Entry: 'index.js' written to: hogehoge.exe
 Finished in 55.151s

exeができました!

exe.PNG

1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1