browserify 오류 / usr / bin / env : 노드 : 해당 파일 또는 디렉토리가 없습니다.
apt-get install 및 모든 종속성을 통해 노드 js 및 npm을 설치 한 다음 browserify를 설치했습니다.
npm install browserify -g
프로세스를 거치고 올바르게 설치된 것처럼 보이지만이 연습에 따라 간단한 번들을 시도하면
오류가 발생합니다.
/ usr / bin / env : node : 해당 파일 또는 디렉토리 없음

일부 Linux 배포판은 nodejs를 "node"실행 파일이 아니라 "nodejs"로 설치합니다.
이 경우 "노드"바이너리 다음에 많은 패키지가 프로그래밍되므로 "노드"에 수동으로 링크해야합니다. 비슷한 일이 "python"에 연결되지 않은 "python2"에서도 발생합니다.
이 경우 쉬운 심볼릭 링크를 할 수 있습니다. 패키지 바이너리를 설치하는 리눅스 배포판의 /usr/bin경우
ln -s /usr/bin/nodejs /usr/bin/node
새로운 답변 :
- 시스템 패키지 관리자 (dnf, apt-get 등)를 통해 설치 한 nodejs 패키지를 제거하고 모든 업그레이드를 다시 생성 한 바보 같은 심볼릭 링크를 삭제합니다 (웃음).
- NVM 설치,
- nvm을 사용하여 nodejs 설치 : nvm install 6
이전 답변 :
심볼릭 링크를 만들거나 다른 노드 패키지를 설치하는 것에 대한 이야기는 허위이며 지속 가능하지 않습니다.
이 문제를 해결하는 올바른 방법은 다음과 같습니다.
- 이미 가지고있는 것처럼 apt-get으로 nodejs 패키지를 간단히 설치하십시오.
update-alternativesnodejs 바이너리가 책임이 있음을 나타내는 데 사용#!/usr/bin/env node
그렇게 :
sudo apt-get install nodejs
sudo update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100
이것은 이제 패키지 업그레이드, dist-upgrade 등을 통해 지속 가능합니다.
을 실행 apt-get install nodejs-legacy합니다.
특정 Linux 배포판은 node.js 바이너리 이름을 변경하여 많은 node.js 패키지와 호환되지 않습니다. 패키지 nodejs-legacy는이를 해결하기위한 심볼릭 링크를 제공합니다.
NVM 또는 Nodejs 버전 관리자를 사용하여 Nodejs를 설치할 수도 있습니다 . 버전 관리자를 사용 하면 많은 이점 이 있습니다. 그중 하나는이 문제에 대해 걱정할 필요가 없다는 것입니다.
명령:
sudo apt-get update
sudo apt-get install build-essential libssl-dev
필수 패키지가 설치되면 프로젝트의 GitHub 페이지에서 nvm 설치 스크립트를 풀다운 할 수 있습니다. 버전 번호는 다를 수 있지만 일반적으로 다음 구문으로 다운로드하여 설치할 수 있습니다.
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
그러면 스크립트가 다운로드되고 실행됩니다. 홈 디렉토리의 하위 디렉토리에 소프트웨어를 설치합니다 ~/.nvm. 또한 ~/.profile파일을 사용하는 데 필요한 행을 파일에 추가 합니다.
To gain access to the nvm functionality, you'll need to log out and log back in again, or you can source the ~/.profile file so that your current session knows about the changes:
source ~/.profile
Now that you have nvm installed, you can install isolated Node.js versions.
To find out the versions of Node.js that are available for installation, you can type:
nvm ls-remote
. . .
v0.11.10
v0.11.11
v0.11.12
v0.11.13
v0.11.14
As you can see, the newest version at the time of this writing is v0.11.14. You can install that by typing:
nvm install 0.11.14
Usually, nvm will switch to use the most recently installed version. You can explicitly tell nvm to use the version we just downloaded by typing:
nvm use 0.11.14
When you install Node.js using nvm, the executable is called node. You can see the version currently being used by the shell by typing:
node -v
The comeplete tutorial can be found here
sudo apt-get install nodejs-legacy
This creates the symlink /usr/bin/node -> nodejs.
Source: https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html
You have to call "nodejs" and not "node". To verify this, type node -v on the shell: if nothing is found try nodejs -v. If that displays a version number, then the command you should be using is nodejs and not node. Therefore, you have to change the call to browserify in your script from node to nodejs (as shown below): replace
#!/usr/bin/env node
with
#!/usr/bin/env nodejs
You might also have to open the script as the superuser.
I seem the same problem when I build atom in Linux.
sudo apt-get install nodejs-dev
Fix my question.hope helpful to you.
If you don't want to symlink you could do this. works in ubuntu
#!/usr/local/bin/node --harmony
harmony tag is for the new ECMAscript harmony
run the command
which nodethe result will be something/home/moh/.nvm/versions/node/v8.9.4/bin/node
위에있는 경로를 복사 한 다음 3 단계에서 명령을 실행합니다.
ln -s /home/moh/.nvm/versions/node/v8.9.4/bin/node /usr/bin/node
'programing tip' 카테고리의 다른 글
| zsh에서 내 프롬프트의 색상을 어떻게 변경할 수 있습니까 (일반 텍스트와 다름)? (0) | 2020.09.15 |
|---|---|
| 단위 테스트에서 HttpClient 모의 (0) | 2020.09.15 |
| 'python'은 내부 또는 외부 명령으로 인식되지 않습니다. (0) | 2020.09.15 |
| 이 난독 화 된 C 코드는 main ()없이 실행된다고 주장하지만 실제로 어떤 역할을합니까? (0) | 2020.09.15 |
| Sqlite 파일 위치 핵심 데이터 (0) | 2020.09.15 |