![](/img/trans.png)
[英]Does a Node.js package.json need to be at the root of the repository?
[英]Node.js - package.json does not exist in user dir
我确实有一个/home/pi/.node-red/package.json但没有npm在/home/pi/package.json的预期位置,所以
npm install
或任何其他节点的任何其他安装会导致以下错误
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.
当我检查它声称的位置时,错误是正确的。 它没有什么期望。 问题是如何解决呢?
是否可以正常使用符号链接到首页,还是您有其他建议? “ npm install”,“ npm cache clean”和“ sudo npm install -g npm”无法解决此问题。
我在具有Linux 4.14.52+ arm LE的Rapsberry PI上运行node -v v8.11.1
这似乎是最新版本: curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
## Installing the NodeSource Node.js 10.x repo...
## You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the NodeSource Linux distributions. Please use the 'linux-armv6l' binary tarballs available directly from nodejs.org for Node.js 4 and later.
要在任何目录中创建package.json,可以调用npm init
命令。 这将提示一些基本问题,并在回答了这些问题后,将创建一个新的package.json文件。 然后,您可以执行npm install
。
您也可以手动创建一个新的package.json文件。
但是,根据您的情况,您似乎不需要package.json(用于node-red)。 您可以使用以下命令全局安装node-red。 (假设您使用的是Linux)
sudo npm install -g node-red
然后用
node-red
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.