[英]npm install throwing errors
当调用npm install
或npm install --save
时,代码会抛出相同的错误。
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/andyc/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/andyc/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/andyc/.npm/_logs/2021-11-04T02_19_18_554Z-debug.log
知道为什么会这样吗?
您似乎没有 package.json。 因此,对于每个新项目,您都需要遵循以下步骤
第1步
npm init --yes
第2步
npm i --save 'packagename'
步骤:3 - 当您通过删除 node_modules 来删除和重新安装软件包时,运行以下命令:
npm i/install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.