【问题标题】:Trying to install npm on Raspberry Pi Error尝试在 Raspberry Pi 错误上安装 npm
【发布时间】:2017-10-29 01:52:57
【问题描述】:

我正在使用 javascript 和电子开发一个简单的智能镜像项目。我能够让该软件在我的笔记本电脑上运行,但是当我将它移到树莓派上时,我在安装 npm 时遇到了问题。输入“npm install”后,我得到了这个:

npm WARN package.json bcrypt-pbkdf@1.0.1 No repository field.
npm ERR! 404 Not Found
npm ERR! 404 
npm ERR! 404 'types/jquery' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 It was specified as a dependency of 'smart-mirror-server'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.

npm ERR! System Linux 4.9.24-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/Desktop/smart-connected-mirror-master
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code E404
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/Desktop/smart-connected-mirror-master/npm-debug.log
npm ERR! not ok code 0

我试过了 sudo apt-get 更新 也 sudo apt-get 升级

有什么想法吗?谢谢!

编辑:

我将 node.js 更新到了更新的版本,现在它安装没有错误。但是,当我输入命令时

 npm start

我明白了:

 sh: 1: electron: Permission denied

 npm ERR! Linux 4.9.24-v7+
 npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
 npm ERR! node v7.10.0
 npm ERR! npm  v4.2.0
 npm ERR! code ELIFECYCLE
 npm ERR! errno 126
 npm ERR! smart-mirror-server@1.0.0 start: `electron .`
 npm ERR! Exit status 126
 npm ERR! 
 npm ERR! Failed at the smart-mirror-server@1.0.0 start script 'electron      .'.
 npm ERR! Make sure you have the latest version of node.js and npm      installed.
 npm ERR! If you do, this is most likely a problem with the smart-mirror-  server package,
 npm ERR! not with npm itself.
 npm ERR! Tell the author that this fails on your system:
 npm ERR!     electron .
 npm ERR! You can get information on how to open an issue for this project with:
 npm ERR!     npm bugs smart-mirror-server
 npm ERR! Or if that isn't available, you can get their info via:
 npm ERR!     npm owner ls smart-mirror-server 
 npm ERR! There is likely additional logging output above.

 npm ERR! Please include the following file with any support request:
 npm ERR!     /home/pi/.npm/_logs/2017-05-29T03_33_22_466Z-debug.log

【问题讨论】:

  • 您使用的 Node.js 版本非常旧。尝试安装更新的版本(例如 v6)。说明可以在这里找到:nodejs.org/en/download/package-manager/…
  • 嗨@robertklep 我更新了node.js,现在它已经正确安装了。但是在输入 npm start 命令后,我收到了一个新错误。我已经编辑了原始帖子以显示此错误。我知道这些可能是简单的问题,但是我对这一切都不熟悉。谢谢。

标签: node.js npm raspberry-pi electron


【解决方案1】:

你看到这个issue了吗? Electron 仅适用于 RaspberryPi 2/3 您使用的是什么版本?
在实际运行应用程序之前,您是否也运行过npm install?有时将node_modules 从操作系统复制到操作系统时,可执行权限会变得非常混乱。
您可以尝试全新安装:rm -rf node_modules && npm install

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-07
    • 1970-01-01
    • 2015-10-07
    • 1970-01-01
    • 2021-06-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多