web-dev-qa-db-ja.com

env:node:そのようなファイルまたはディレクトリはありません

env:node:そのようなファイルまたはディレクトリはありません

ノードのディレクトリが間違っていないかどうかを確認しましたが、問題ありません。

私はすでにこれらの次の回答を試しました:1. https://github.com/nodejs/node-v0.x-archive/issues/3911 2. https://github.com/creationix/nvm/issues/1702 3. ブラウザエラー/ usr/bin/env:node:No such file or directory

USER-no-MacBook-Pro-2:nomadcoin user$ yarn init
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ brew install node
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
acpica                   fantom                   lego                     qmmp
bat                      fn                       libdca                   rubberband
bazel                    fselect                  libpqxx                  Ruby-build
cake                     fstar                    nativefier               saxon
calabash                 groovysdk                openimageio              shellcheck
cdrdao                   h2o                      pegtl                    sqlmap
cmake                    hadoop                   percona-server           teleport
conan                    heroku                   phpunit                  urh
convox                   jenkins-job-builder      pike
etcd                     jetty                    ponyc
exomizer                 jetty-runner             pygobject3

Warning: node 10.3.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
USER-no-MacBook-Pro-2:nomadcoin user$ brew link node
Linking /usr/local/Cellar/node/10.3.0...
Error: Could not symlink include/node/Android-ifaddrs.h
Target /usr/local/include/node/Android-ifaddrs.h
already exists. You may want to remove it:
  rm '/usr/local/include/node/Android-ifaddrs.h'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

To list all files that would be deleted:
  brew link --overwrite --dry-run node
USER-no-MacBook-Pro-2:nomadcoin user$ brew link --overwrite --dry-run node
Would remove:
/usr/local/include/node/Android-ifaddrs.h
/usr/local/include/node/common.gypi
/usr/local/include/node/config.gypi
/usr/local/include/node/libplatform/libplatform-export.h
/usr/local/include/node/libplatform/libplatform.h
/usr/local/include/node/libplatform/v8-tracing.h
/usr/local/include/node/node.h
/usr/local/include/node/node_api.h
/usr/local/include/node/node_api_types.h
/usr/local/include/node/node_buffer.h
/usr/local/include/node/node_object_wrap.h
/usr/local/include/node/node_version.h
/usr/local/include/node/openssl/aes.h
/usr/local/include/node/openssl/asn1.h
/usr/local/include/node/openssl/asn1_mac.h
/usr/local/include/node/openssl/asn1t.h
/usr/local/include/node/openssl/bio.h
/usr/local/include/node/openssl/blowfish.h
/usr/local/include/node/openssl/bn.h
/usr/local/include/node/openssl/buffer.h
/usr/local/include/node/openssl/camellia.h
/usr/local/include/node/openssl/cast.h
/usr/local/include/node/openssl/cmac.h
/usr/local/include/node/openssl/cms.h
/usr/local/include/node/openssl/comp.h
/usr/local/include/node/openssl/conf.h
/usr/local/include/node/openssl/conf_api.h
/usr/local/include/node/openssl/crypto.h
/usr/local/include/node/openssl/des.h
/usr/local/include/node/openssl/dh.h
/usr/local/include/node/openssl/dsa.h
/usr/local/include/node/openssl/dtls1.h
/usr/local/include/node/openssl/e_os2.h
/usr/local/include/node/openssl/ebcdic.h
/usr/local/include/node/openssl/ec.h
/usr/local/include/node/openssl/ecdh.h
/usr/local/include/node/openssl/ecdsa.h
/usr/local/include/node/openssl/engine.h
/usr/local/include/node/openssl/err.h
/usr/local/include/node/openssl/evp.h
/usr/local/include/node/openssl/hmac.h
/usr/local/include/node/openssl/idea.h
/usr/local/include/node/openssl/lhash.h
/usr/local/include/node/openssl/md4.h
/usr/local/include/node/openssl/md5.h
/usr/local/include/node/openssl/mdc2.h
/usr/local/include/node/openssl/modes.h
/usr/local/include/node/openssl/obj_mac.h
/usr/local/include/node/openssl/objects.h
/usr/local/include/node/openssl/ocsp.h
/usr/local/include/node/openssl/opensslconf.h
/usr/local/include/node/openssl/opensslv.h
/usr/local/include/node/openssl/ossl_typ.h
/usr/local/include/node/openssl/pem.h
/usr/local/include/node/openssl/pem2.h
/usr/local/include/node/openssl/pkcs12.h
/usr/local/include/node/openssl/pkcs7.h
/usr/local/include/node/openssl/Rand.h
/usr/local/include/node/openssl/rc2.h
/usr/local/include/node/openssl/rc4.h
/usr/local/include/node/openssl/ripemd.h
/usr/local/include/node/openssl/rsa.h
/usr/local/include/node/openssl/safestack.h
/usr/local/include/node/openssl/seed.h
/usr/local/include/node/openssl/sha.h
/usr/local/include/node/openssl/srp.h
/usr/local/include/node/openssl/srtp.h
/usr/local/include/node/openssl/ssl.h
/usr/local/include/node/openssl/ssl2.h
/usr/local/include/node/openssl/ssl3.h
/usr/local/include/node/openssl/stack.h
/usr/local/include/node/openssl/symhacks.h
/usr/local/include/node/openssl/tls1.h
/usr/local/include/node/openssl/ts.h
/usr/local/include/node/openssl/txt_db.h
/usr/local/include/node/openssl/ui.h
/usr/local/include/node/openssl/whrlpool.h
/usr/local/include/node/openssl/x509.h
/usr/local/include/node/openssl/x509_vfy.h
/usr/local/include/node/openssl/x509v3.h
/usr/local/include/node/pthread-barrier.h
/usr/local/include/node/stdint-msvc2008.h
/usr/local/include/node/tree.h
/usr/local/include/node/uv-aix.h
/usr/local/include/node/uv-bsd.h
/usr/local/include/node/uv-darwin.h
/usr/local/include/node/uv-errno.h
/usr/local/include/node/uv-linux.h
/usr/local/include/node/uv-os390.h
/usr/local/include/node/uv-posix.h
/usr/local/include/node/uv-sunos.h
/usr/local/include/node/uv-threadpool.h
/usr/local/include/node/uv-unix.h
/usr/local/include/node/uv-version.h
/usr/local/include/node/uv-win.h
/usr/local/include/node/uv.h
/usr/local/include/node/v8-inspector-protocol.h
/usr/local/include/node/v8-inspector.h
/usr/local/include/node/v8-platform.h
/usr/local/include/node/v8-profiler.h
/usr/local/include/node/v8-testing.h
/usr/local/include/node/v8-util.h
/usr/local/include/node/v8-value-serializer-version.h
/usr/local/include/node/v8-version-string.h
/usr/local/include/node/v8-version.h
/usr/local/include/node/v8.h
/usr/local/include/node/v8config.h
/usr/local/include/node/zconf.h
/usr/local/include/node/zlib.h
/usr/local/share/doc/node/gdbinit
/usr/local/share/doc/node/lldb_commands.py
/usr/local/share/doc/node/lldbinit
/usr/local/share/man/man1/node.1
/usr/local/share/systemtap/tapset/node.stp
/usr/local/lib/dtrace/node.d
USER-no-MacBook-Pro-2:nomadcoin user$ brew link node
Linking /usr/local/Cellar/node/10.3.0...
Error: Could not symlink include/node/Android-ifaddrs.h
Target /usr/local/include/node/Android-ifaddrs.h
already exists. You may want to remove it:
  rm '/usr/local/include/node/Android-ifaddrs.h'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

To list all files that would be deleted:
  brew link --overwrite --dry-run node
USER-no-MacBook-Pro-2:nomadcoin user$ run node
bash: run: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ brew install node --force
Warning: node 10.3.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
USER-no-MacBook-Pro-2:nomadcoin user$ brew install node --rf
Warning: node 10.3.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
USER-no-MacBook-Pro-2:nomadcoin user$ brew install -rf node
Warning: node 10.3.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
USER-no-MacBook-Pro-2:nomadcoin user$ node install yarn
bash: node: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ npm install yarn
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ brew install yarn -g
Warning: yarn 1.7.0 is already installed and up-to-date
To reinstall 1.7.0, run `brew reinstall yarn`
USER-no-MacBook-Pro-2:nomadcoin user$ brew reinstall yarn
==> Reinstalling yarn
==> Downloading https://yarnpkg.com/downloads/1.7.0/yarn-v1.7.0.tar.gz
Already downloaded: /Users/user/Library/Caches/Homebrew/yarn-1.7.0.tar.gz
????  /usr/local/Cellar/yarn/1.7.0: 14 files, 4.2MB, built in 1 second
USER-no-MacBook-Pro-2:nomadcoin user$ yarn install
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ yarn init
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ ln -s /usr/bin/nodejs /usr/bin/node
ln: /usr/bin/node: Operation not permitted
USER-no-MacBook-Pro-2:nomadcoin user$ Sudo ln -s /usr/bin/nodejs /usr/bin/node
Password:
ln: /usr/bin/node: Operation not permitted
USER-no-MacBook-Pro-2:nomadcoin user$ $ Sudo apt-get install nodejs-legacy
bash: $: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ $ Sudo brew install nodejs-legacy
bash: $: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ npm debug
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ nvm debug
bash: nvm: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ Sudo chown -R $USER /usr/local
chown: /usr/local: Operation not permitted
USER-no-MacBook-Pro-2:nomadcoin user$ npm --version
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ nvm --version
bash: nvm: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ nvm install
bash: nvm: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ ln -s /usr/local/Cellar/node /usr/bin/node
ln: /usr/bin/node: Operation not permitted
USER-no-MacBook-Pro-2:nomadcoin user$
  • ノードをインストールしたかどうかを確認するには、_node -v_を試してください。ノードが機能していないと思います。

  • nvmは、ノードの環境管理です。 nvmを使用している場合は、_brew install nvm_を使用し、_nvm install version-of-node-you-want-to-install_を使用してノードをインストールし、_nvm use the-version_を使用してノードを機能させる必要があります。

  • インストールチェーン全体は次のとおりです。

    • _brew install nvm_、ノードの環境/バージョン管理であるnvmをインストールします。

    • _nvm install 10.3.0_、nodeおよびnpmをインストールするには

    • _npm install -g yarn_、yarnをインストールします

    • _node -v_、_npm -v_、_nvm -v_、_yarn -v_を使用して、すべてが機能するかどうかを確認します。

10
John

Ubuntuでnpmバージョンを更新しようとすると、同じ問題が発生しました。

Sudo npm install -g npm

私はSudoなしで同じことをすることで解決しました:

npm install -g npm
0
Francesco Borzi