Jump to content
kalibannez

Установка пакетов через npm

3 posts in this topic

Здравствуйте!

Мне потребовалось установить пакет из npm, для этого я установил node и node-npm через opkg, успешно, все работает.

Далее я пытаюсь установить node-gyp через npm, выполнив команду 

sudo npm install -g --unsafe-perm node-gyp

все завершается успешно, пакет node-gyp появляется в /opt/lib/node_modules/node-gyp, в /opt/bin появляется правильная символьная ссылка на исполняемый файл node-gyp.

Однако, при попытке запустить node-gyp я получаю:

root@GigaDisk:/opt/bin# node-gyp
/opt/bin/sh: node-gyp: not found

При этом автокомплит работает, система о node-gyp вроде как знает:

root@GigaDisk:/opt/bin# which node-gyp
/opt/bin/node-gyp

Помогите, пожалуйста, разобраться в чем проблема. 

Share this post


Link to post
Share on other sites
4 часа назад, kalibannez сказал:

Помогите, пожалуйста, разобраться в чем проблема. 

"чистая установка"

Скрытый текст

 


~ # 
~ # opkg install node-npm
Installing node-npm (v8.12.0-1) to root...
Downloading http://bin.entware.net/mipselsf-k3.4/node-npm_v8.12.0-1_mipsel-3.4.ipk
Installing node (v8.12.0-1) to root...
Downloading http://bin.entware.net/mipselsf-k3.4/node_v8.12.0-1_mipsel-3.4.ipk
Configuring node.
Configuring node-npm.
~ # 
~ # npm install -g --unsafe-perm node-gyp
/opt/bin/node-gyp -> /opt/lib/node_modules/node-gyp/bin/node-gyp.js
+ node-gyp@3.8.0
added 97 packages from 67 contributors in 79.968s
~ # 
~ # node-gyp --help
-sh: node-gyp: not found
~ # 

 

"проверка теории"

Скрытый текст

 


~ # 
~ # find /opt/lib/node_modules/ -type f | xargs -r grep "^#!.*bash"
/opt/lib/node_modules/node-gyp/node_modules/dashdash/etc/dashdash.bash_completion.in:#!/bin/bash
/opt/lib/node_modules/node-gyp/node_modules/ajv/scripts/travis-gh-pages:#!/usr/bin/env bash
/opt/lib/node_modules/node-gyp/node_modules/ajv/scripts/publish-built-version:#!/usr/bin/env bash
/opt/lib/node_modules/node-gyp/test/docker.sh:#!/bin/bash
/opt/lib/node_modules/npm/node_modules/dashdash/etc/dashdash.bash_completion.in:#!/bin/bash
/opt/lib/node_modules/npm/node_modules/lockfile/gen-changelog.sh:#!/bin/bash
/opt/lib/node_modules/npm/node_modules/ajv/scripts/travis-gh-pages:#!/usr/bin/env bash
/opt/lib/node_modules/npm/lib/utils/completion.sh:#!/bin/bash

~ # find /opt/lib/node_modules/ -type f | xargs -r grep "^#!.*node"
/opt/lib/node_modules/node-gyp/node_modules/which/bin/which:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/rimraf/bin.js:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/sshpk/bin/sshpk-verify:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/sshpk/bin/sshpk-sign:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/sshpk/bin/sshpk-conv:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/mkdirp/bin/cmd.js:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/performance-now/test/scripts/initial-value.coffee:#!/usr/bin/env ./node_modules/.bin/coffee
/opt/lib/node_modules/node-gyp/node_modules/performance-now/test/scripts/delayed-call.coffee:#!/usr/bin/env ./node_modules/.bin/coffee
/opt/lib/node_modules/node-gyp/node_modules/performance-now/test/scripts/delayed-require.coffee:#!/usr/bin/env ./node_modules/.bin/coffee
/opt/lib/node_modules/node-gyp/node_modules/performance-now/test/scripts/difference.coffee:#!/usr/bin/env ./node_modules/.bin/coffee
/opt/lib/node_modules/node-gyp/node_modules/semver/bin/semver:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/uuid/bin/uuid:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/ajv/scripts/info:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/nopt/bin/nopt.js:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/node_modules/nopt/examples/my-program.js:#!/usr/bin/env node
/opt/lib/node_modules/node-gyp/bin/node-gyp.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/which/bin/which:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/rimraf/bin.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/qrcode-terminal/bin/qrcode-terminal.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/sshpk/bin/sshpk-verify:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/sshpk/bin/sshpk-sign:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/sshpk/bin/sshpk-conv:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/node-gyp/node_modules/semver/bin/semver:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/node-gyp/node_modules/nopt/bin/nopt.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/node-gyp/node_modules/nopt/examples/my-program.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/is-ci/bin.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/mkdirp/bin/cmd.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/semver/bin/semver:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/errno/cli.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/errno/build.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/uuid/bin/uuid:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/yargs/README.md:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/yargs/README.md:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/ajv/scripts/info:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/rc/cli.js:#! /usr/bin/env node
/opt/lib/node_modules/npm/node_modules/JSONStream/bin.js:#! /usr/bin/env node
/opt/lib/node_modules/npm/node_modules/opener/bin/opener-bin.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/nopt/bin/nopt.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/node_modules/nopt/examples/my-program.js:#!/usr/bin/env node
/opt/lib/node_modules/npm/bin/npx-cli.js:#!/opt/bin/node
/opt/lib/node_modules/npm/bin/npm-cli.js:#!/opt/bin/node

~ # find /opt/lib/node_modules/ -type f | xargs -r grep "^#!.*python"
/opt/lib/node_modules/node-gyp/gyp/samples/samples:#!/usr/bin/python
/opt/lib/node_modules/node-gyp/gyp/setup.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/input_test.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/common_test.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/tools/pretty_vcproj.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/tools/graphviz.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/tools/pretty_gyp.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/tools/pretty_sln.py:#!/usr/bin/env python
/opt/lib/node_modules/node-gyp/gyp/gyp_main.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/samples/samples:#!/usr/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/setup.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common_test.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/tools/pretty_vcproj.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/tools/graphviz.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/tools/pretty_gyp.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/tools/pretty_sln.py:#!/usr/bin/env python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py:#!/usr/bin/env python
~ # 

 

"фокус-покус"

Скрытый текст

 


~ # 
~ # find /opt/lib/node_modules/ -type f -not -name '*.coffee' | \
xargs -r sed -i -e 's,^#!.*bash,#!/opt/bin/bash,' \
-e 's,^#!.*node,#!/opt/bin/node,' \
-e 's,^#!.*python,#!/opt/bin/python,'
~ # 

 

проверка результата

Скрытый текст

 


~ # 
~ # find /opt/lib/node_modules/ -type f | xargs -r grep "^#!.*bash"
/opt/lib/node_modules/node-gyp/node_modules/dashdash/etc/dashdash.bash_completion.in:#!/opt/bin/bash
/opt/lib/node_modules/node-gyp/node_modules/ajv/scripts/travis-gh-pages:#!/opt/bin/bash
/opt/lib/node_modules/node-gyp/node_modules/ajv/scripts/publish-built-version:#!/opt/bin/bash
/opt/lib/node_modules/node-gyp/test/docker.sh:#!/opt/bin/bash
/opt/lib/node_modules/npm/node_modules/dashdash/etc/dashdash.bash_completion.in:#!/opt/bin/bash
/opt/lib/node_modules/npm/node_modules/lockfile/gen-changelog.sh:#!/opt/bin/bash
/opt/lib/node_modules/npm/node_modules/ajv/scripts/travis-gh-pages:#!/opt/bin/bash
/opt/lib/node_modules/npm/lib/utils/completion.sh:#!/opt/bin/bash

~ # find /opt/lib/node_modules/ -type f | xargs -r grep "^#!.*node"
/opt/lib/node_modules/node-gyp/node_modules/which/bin/which:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/rimraf/bin.js:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/sshpk/bin/sshpk-verify:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/sshpk/bin/sshpk-sign:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/sshpk/bin/sshpk-conv:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/mkdirp/bin/cmd.js:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/performance-now/test/scripts/initial-value.coffee:#!/usr/bin/env ./node_modules/.bin/coffee
/opt/lib/node_modules/node-gyp/node_modules/performance-now/test/scripts/delayed-call.coffee:#!/usr/bin/env ./node_modules/.bin/coffee
/opt/lib/node_modules/node-gyp/node_modules/performance-now/test/scripts/delayed-require.coffee:#!/usr/bin/env ./node_modules/.bin/coffee
/opt/lib/node_modules/node-gyp/node_modules/performance-now/test/scripts/difference.coffee:#!/usr/bin/env ./node_modules/.bin/coffee
/opt/lib/node_modules/node-gyp/node_modules/semver/bin/semver:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/uuid/bin/uuid:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/ajv/scripts/info:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/nopt/bin/nopt.js:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/node_modules/nopt/examples/my-program.js:#!/opt/bin/node
/opt/lib/node_modules/node-gyp/bin/node-gyp.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/which/bin/which:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/rimraf/bin.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/qrcode-terminal/bin/qrcode-terminal.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/sshpk/bin/sshpk-verify:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/sshpk/bin/sshpk-sign:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/sshpk/bin/sshpk-conv:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/node-gyp/node_modules/semver/bin/semver:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/node-gyp/node_modules/nopt/bin/nopt.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/node-gyp/node_modules/nopt/examples/my-program.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/is-ci/bin.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/mkdirp/bin/cmd.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/semver/bin/semver:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/errno/cli.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/errno/build.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/uuid/bin/uuid:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/yargs/README.md:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/yargs/README.md:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/ajv/scripts/info:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/rc/cli.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/JSONStream/bin.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/opener/bin/opener-bin.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/nopt/bin/nopt.js:#!/opt/bin/node
/opt/lib/node_modules/npm/node_modules/nopt/examples/my-program.js:#!/opt/bin/node
/opt/lib/node_modules/npm/bin/npx-cli.js:#!/opt/bin/node
/opt/lib/node_modules/npm/bin/npm-cli.js:#!/opt/bin/node

~ # find /opt/lib/node_modules/ -type f | xargs -r grep "^#!.*python"
/opt/lib/node_modules/node-gyp/gyp/samples/samples:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/setup.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/input_test.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/common_test.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/tools/pretty_vcproj.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/tools/graphviz.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/tools/pretty_gyp.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/tools/pretty_sln.py:#!/opt/bin/python
/opt/lib/node_modules/node-gyp/gyp/gyp_main.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/samples/samples:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/setup.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common_test.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/tools/pretty_vcproj.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/tools/graphviz.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/tools/pretty_gyp.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/tools/pretty_sln.py:#!/opt/bin/python
/opt/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py:#!/opt/bin/python
~ # 

 

бинго-о-о

~ # 
~ # node-gyp --help

  Usage: node-gyp <command> [options]

  where <command> is one of:
    - build - Invokes `make` and builds the module
    - clean - Removes any generated build files and the "out" dir
    - configure - Generates a Makefile for the current module
    - rebuild - Runs "clean", "configure" and "build" all at once
    - install - Install node development files for the specified node version.
    - list - Prints a listing of the currently installed node development files
    - remove - Removes the node development files for the specified version

node-gyp@3.8.0  /opt/lib/node_modules/node-gyp
node@8.12.0
~ # 

;)

  • Upvote 2

Share this post


Link to post
Share on other sites

TheBBбольшое спасибо, конечно, нужно было догадаться что просто указан не верный путь до интерпретатора.

Для тех, кто столкнется с такой же проблемой в будущем- вероятно, пункт "фокус-покус" нужно будет проделать для всех пакетов, установленных с помощью npm, ибо во всех, что я ставил путь был вида

/usr/bin/env bash

а в системе роутера так:

/opt/bin/bash

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×