我是nodejs的新手。我正在尝试按照文档安装nodejs。在使用npm install命令安装依赖项时,我遇到了一个错误。
C:\Program Files\nodejs>npm install
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.3.1
npm ERR! npm v2.14.12
npm ERR! path C:\Program Files\nodejs\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open 'C:\Program Files\
nodejs\package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directo
ry.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Program Files\nodejs\npm-debug.log
C:\Program Files\nodejs>在package.json文件所在的文件夹中运行npm install命令后,会出现以下错误:
C:\Program Files\nodejs>npm install
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.3.1
npm ERR! npm v2.14.12
npm ERR! path C:\Program Files\nodejs\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open 'C:\Program Files\
nodejs\package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directo
ry.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Program Files\nodejs\npm-debug.log
C:\Program Files\nodejs>link for npm-debug log file..如有任何帮助,将不胜感激..谢谢..
发布于 2016-02-20 23:18:28
要安装依赖项节点,请在项目根目录中查找名为package.json的文件,其中包含项目所需的所有依赖项的列表。它的内容看起来像something like this:
听起来您在项目的根目录中缺少package.json。
要安装依赖项,通常需要运行如下命令
npm install NAMEOFTHEDEPENDENCY --save-dev其中NAMEOFTHEDEPENDENCY可以是grunt-contrib-sass,例如
这也会自动更新您的package.json
发布于 2020-03-09 19:59:40
安装nodejs后,试着关闭你的代码编辑器,重新打开并运行npm install,在与package.json文件相同的目录下,忘了说,你是从https://nodejs.org/en/download/安装nodejs的吗?
发布于 2016-02-20 23:16:28
为了使npm install正常工作,您需要与package.json文件位于相同的目录中。然后,npm install查看package.json并在其中安装所有依赖项。
https://docs.npmjs.com/files/package.json
https://docs.npmjs.com/getting-started/installing-npm-packages-locally
https://stackoverflow.com/questions/35525069
复制相似问题