“Ubuntu 环境下npm使用时报错 node: not found 的处理方法”
来源:互联网 发布:js点击弹出对话框 编辑:程序博客网 时间:2024/06/02 04:47
错误信息: npm ERR ; node: not found ; npm ERR! not ok code 0
解决方案:
sudo apt-get install nodejs-legacy
也可以尝试
ln -s /usr/bin/nodejs /usr/bin/node
问题解决思路:
本人是在安装hexo时出现的错误,即下列操作
npm install hexo-cli -g
错误信息中有如下信息
npm ERR! not ok code 0npm WARN This failure might be due to the use of legacy binary "node"npm WARN For further explanations, please read/usr/share/doc/nodejs/README.Debian
根据提示信息打开文件
vim /usr/share/doc/nodejs/README.Debian
文件中7-8行文字:
The global search path for modules is /usr/lib/nodejs
32-40行文字:
The upstream name for the Node.js interpreter command is "node".In Debian the interpreter command has been changed to "nodejs".This was done to prevent a namespace collision: other commands use the same name in their upstreams, such as ax25-node from the "node"package.Scripts calling Node.js as a shell command must be changed to insteaduse the "nodejs" command.
从上述文中中可以看出 在debian中 可执行文件node已经被修改成nodejs
因此npm执行的过程中找不到node可执行文件,故而出错。
执行命令
ll /usr/bin/node*
结果:
lrwxrwxrwx 1 root root 33 10月 22 2013 /usr/bin/node-gyp -> ../share/node-gyp/bin/node-gyp.js*-rwxr-xr-x 1 root root 1462424 3月 27 2014 /usr/bin/nodejs*
从结果可知,可执行文件node意见改成了nodejs,这也是找不到 node 以及 npm install 安装一些模块时失败的原因
因此可执行文中开头的两种方法之一解决该问题
再次执行
ll /usr/bin/node*
结果:
lrwxrwxrwx 1 root root 6 3月 27 2014 /usr/bin/node -> nodejs*lrwxrwxrwx 1 root root 33 10月 22 2013 /usr/bin/node-gyp -> ../share/node-gyp/bin/node-gyp.js*-rwxr-xr-x 1 root root 1462424 3月 27 2014 /usr/bin/nodejs*
此时再次执行npm相关的指令就OK了。
说明:本人采用的是第一种方法。
0 0
- “Ubuntu 环境下npm使用时报错 node: not found 的处理方法”
- ubuntu 14.04环境下执行adb shell 时报错 error: device not found.的解决方法
- 使用npm安装node-sass时报错
- ubuntu下nvm,node以及npm的安装与使用
- ubuntu下nvm,node以及npm的安装与使用
- Mac环境下装node.js,npm,express;(包括express command not found)
- node npm 安装时报错解决
- 启动apache时报错libmysqlclient.so.16 not found的处理
- windows下搭建node.js及npm的工作环境
- windows下搭建node.js及npm的工作环境
- MATLAB启动时报错: pathdef.m not found 问题解决方法
- kali 下安装npm------------bash:not found npm
- ubuntu 16.04 使用 (2) - git node npm
- npm command not found
- ubuntu node 和 npm 的安装
- sae下使用storage报Container not found.的错
- adb pull 时报错device not found
- Maven deploy时报Fatal error compiling: tools.jar not found错误的问题处理
- 124. Binary Tree Maximum Path Sum
- Android Studio官方文档之Android Studio创建工程项目篇
- 4.1.6 文件系统基础
- (3) 百度2011研发工程师笔试卷
- [3.2.0]JVM调优原理以及降低Cache操作的内存占比
- “Ubuntu 环境下npm使用时报错 node: not found 的处理方法”
- 关于ARGB_8888、ALPHA_8、ARGB_4444、RGB_565的理解
- springmvc 启动错误java.lang.IllegalArgumentException
- JavaScript学习总结(五)原型和原型链详解
- Android利用ViewPager+GridView,实现网格布局(功能列表)并能水平滑动
- matlab-基础 plot输出的图像的线变粗
- hbase 增删改查基本操作
- leetcode 87 Scramble String(递归+剪枝)
- linux mint上安装vim spf13