vunb / node-crfsuite

A nodejs binding for crfsuite
MIT License
14 stars 11 forks source link

Build step failure #13

Closed SalathielGenese closed 5 years ago

SalathielGenese commented 5 years ago

See the trail log

salathiel@salathiel-genese-pc:~$ git clone https://github.com/vunb/node-crfsuite.git
Cloning into 'node-crfsuite'...
cd node-crfsuite
remote: Enumerating objects: 80, done.
remote: Counting objects: 100% (80/80), done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 250 (delta 44), reused 56 (delta 26), pack-reused 170
Receiving objects: 100% (250/250), 520.92 KiB | 543.00 KiB/s, done.
Resolving deltas: 100% (129/129), done.
salathiel@salathiel-genese-pc:~$ cd node-crfsuite
salathiel@salathiel-genese-pc:~/node-crfsuite$ npm install

> crfsuite@0.9.6 install /home/salathiel/node-crfsuite
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
[crfsuite] Success: "/home/salathiel/node-crfsuite/lib/binding/napi-v3/crfsuite.node" is installed via remote
npm notice created a lockfile as package-lock.json. You should commit this file.
added 195 packages from 120 contributors and audited 395 packages in 19.632s
found 0 vulnerabilities

salathiel@salathiel-genese-pc:~/node-crfsuite$ npm run build

> crfsuite@0.9.6 build /home/salathiel/node-crfsuite
> node-pre-gyp rebuild

[crfsuite] Removing "/home/salathiel/node-crfsuite/lib/binding/napi-v3"
make: Entering directory '/home/salathiel/node-crfsuite/build'
make: *** No rule to make target 'Release/obj.target/crfsuite/liblbfgs/lib/lbfgs.o', needed by 'Release/obj.target/crfsuite.node'.  Stop.
make: Leaving directory '/home/salathiel/node-crfsuite/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/salathiel/.nvm/versions/node/v11.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:193:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:255:12)
gyp ERR! System Linux 5.0.0-19-generic
gyp ERR! command "/home/salathiel/.nvm/versions/node/v11.13.0/bin/node" "/home/salathiel/.nvm/versions/node/v11.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--module=/home/salathiel/node-crfsuite/lib/binding/napi-v1/crfsuite.node" "--module_name=crfsuite" "--module_path=/home/salathiel/node-crfsuite/lib/binding/napi-v1" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=1" "--node_napi_label=napi-v1"
gyp ERR! cwd /home/salathiel/node-crfsuite
gyp ERR! node -v v11.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/salathiel/.nvm/versions/node/v11.13.0/bin/node /home/salathiel/.nvm/versions/node/v11.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --module=/home/salathiel/node-crfsuite/lib/binding/napi-v1/crfsuite.node --module_name=crfsuite --module_path=/home/salathiel/node-crfsuite/lib/binding/napi-v1 --napi_version=4 --node_abi_napi=napi --napi_build_version=1 --node_napi_label=napi-v1' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/salathiel/node-crfsuite/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:193:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1001:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
node-pre-gyp ERR! System Linux 5.0.0-19-generic
node-pre-gyp ERR! command "/home/salathiel/.nvm/versions/node/v11.13.0/bin/node" "/home/salathiel/node-crfsuite/node_modules/.bin/node-pre-gyp" "rebuild"
node-pre-gyp ERR! cwd /home/salathiel/node-crfsuite
node-pre-gyp ERR! node -v v11.13.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok 
Failed to execute '/home/salathiel/.nvm/versions/node/v11.13.0/bin/node /home/salathiel/.nvm/versions/node/v11.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --module=/home/salathiel/node-crfsuite/lib/binding/napi-v1/crfsuite.node --module_name=crfsuite --module_path=/home/salathiel/node-crfsuite/lib/binding/napi-v1 --napi_version=4 --node_abi_napi=napi --napi_build_version=1 --node_napi_label=napi-v1' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! crfsuite@0.9.6 build: `node-pre-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the crfsuite@0.9.6 build 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!     /home/salathiel/.npm/_logs/2019-06-27T09_45_50_036Z-debug.log
vunb commented 5 years ago

Thank you for reporting the issue. I will investigate it soon

SalathielGenese commented 5 years ago

We actually use ingredient-phrase-tagger which depends on crfsuite and here we go... For a containerized app under alpine (most of the time).

The way round we actually found was to write a setup script :


if test ! -d "${PROJECT_ROOT}/node-crfsuite" ; then
    # Download sources for `crfsuite`
    git clone "https://github.com/vunb/node-crfsuite.git" "${PROJECT_ROOT}/node-crfsuite"
    git clone "https://github.com/chokkan/crfsuite.git" "${PROJECT_ROOT}/node-crfsuite/crfsuite"
    git clone "https://github.com/chokkan/liblbfgs.git" "${PROJECT_ROOT}/node-crfsuite/liblbfgs"

    # Install dependencies and build `crfsuite`
    cd "${PROJECT_ROOT}/node-crfsuite"
    npm install
    npm run build
fi

# Install project dependencies
cd "${PROJECT_ROOT}"
# npm uninstall node-crfsuite ingredient-phrase-tagger
npm install ./node-crfsuite
npm install ingredient-phrase-tagger
npm install

It would be awesome if we didn't have to do this manually.

vunb commented 5 years ago

If you want build from source, just clone with option --recursive. The error above cause by the dependencies chokkan/crfsuite, chokkan/liblbfgs not dowloaded.

FYI: I have just updated the library uses node N-API to use the binary in multiple version of Node. So now, from crfsuite@0.9.6 your project only need run npm install crfsuite.

Please re-try and let me know the result?

SalathielGenese commented 5 years ago

Awesome !!!

Much thanks @vunb . Documenting it would be next to awesome :bouquet:

vunb commented 5 years ago

@SalathielGenese Okay! I am also considering update the document.