这里有树莓和节点的新手。
我已经按照以下说明在运行Raspbian的树莓派上更新了nodejs,但是当我检查Express模块是否正确安装时(通过npm list命令),我得到以下信息(请原谅复制粘贴生成的特殊字符):
pi@cutiepi ~ $ npm list
/home/pi
âââ UNMET DEPENDENCY express *
ââ⬠[email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected]
ââ⬠[email protected]
ââ⬠[email protected]
â âââ [email protected]
âââ [email protected]
ââ⬠[email protected]
â âââ [email protected]
â âââ [email protected]
â âââ [email protected]
â âââ [email protected]
âââ [email protected]
npm ERR! missing: express@*, required by undefined@undefined
npm ERR! not ok code 0
我已经在上述步骤之前运行了这些步骤,并且每个步骤看起来都已成功完成:
335 node -v
336 npm -v
337 nodejs -v
338 npm list
339 sudo apt-get purge nodejs
340 nodejs -v
341 which nodejs
342 sudo apt-get update
343 sudo apt-get install python-software-properties
344 sudo add-apt-repository ppa:chris-lea/node.js
345 sudo apt-get update
346 sudo apt-get install nodejs
347 which nodejs
348 nodejs -v
349 sudo npm install express -g
350 which express
351 npm list
寻找任何建议,我可以解决这个问题。在此先感谢您,如果可以提供更多有用的信息,请告诉我。
npm install -g
全局安装模块,允许您使用其导出的命令行工具(如果有)。
要从代码调用该模块require()
,您需要在本地安装该模块,而无需安装-g
。
要编写Node.js项目,您应该创建自己的package.json
文件,其中列出了您的依赖项,然后运行npm install
以将其全部安装在本地。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句