Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodejs: Cannot install opencc@1.1.8 #908

Closed
Cerallin opened this issue Oct 13, 2024 · 3 comments
Closed

nodejs: Cannot install opencc@1.1.8 #908

Cerallin opened this issue Oct 13, 2024 · 3 comments

Comments

@Cerallin
Copy link

This is because data/scripts are missing, and not uploaded to npm.

Part of the logs:

...
npm error python: can't open file '/workspaces/website/node_modules/opencc/data/scripts/merge.py': [Errno 2] No such file or directory
npm error make: *** [dicts.target.mk:104: Release/TWPhrases.txt] Error 2
npm error gyp ERR! build error 
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm error gyp ERR! System Linux 6.5.0-1025-azure
npm error gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--module=/workspaces/website/node_modules/opencc/build/Release/opencc.node" "--module_name=opencc" "--module_path=/workspaces/website/node_modules/opencc/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115"
npm error gyp ERR! cwd /workspaces/website/node_modules/opencc
npm error gyp ERR! node -v v20.18.0
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok 
npm error node-pre-gyp ERR! build error 
npm error node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --module=/workspaces/website/node_modules/opencc/build/Release/opencc.node --module_name=opencc --module_path=/workspaces/website/node_modules/opencc/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
npm error node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/workspaces/website/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm error node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
npm error node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm error node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm error node-pre-gyp ERR! System Linux 6.5.0-1025-azure
npm error node-pre-gyp ERR! command "/usr/bin/node" "/workspaces/website/node_modules/.bin/node-pre-gyp" "rebuild"
npm error node-pre-gyp ERR! cwd /workspaces/website/node_modules/opencc
npm error node-pre-gyp ERR! node -v v20.18.0
npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm error node-pre-gyp ERR! not ok
npm error A complete log of this run can be found in: /root/.npm/_logs/2024-10-13T06_12_36_082Z-debug-0.log
@BYVoid
Copy link
Owner

BYVoid commented Oct 18, 2024

does python exist?

@Cerallin
Copy link
Author

does python exist?

At first I executed npm install, and it reported an error: cannot find python. So I made a soft link ln -s /usr/bin/python3 /bin/python. Then npm install again.

This is where we are now. (Is python3 the right version?)

@tomcatliu2016
Copy link

I have fixed the issue and created a pull request (PR):
#911
As a temporary workaround until the npm package is updated, you can do the following:

  1. Clone my forked repository on the fix_npm_install_error branch:
    https://github.com/tomcatliu2016/OpenCC/tree/fix_npm_install_error
  2. Navigate to the OpenCC directory and create a tarball:
cd OpenCC
npm pack

  1. In your Node.js project, install the tarball:
npm install /path/to/tarball

This method serves as a temporary solution until the npm package is officially updated.

@BYVoid BYVoid closed this as completed Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants