npm install没有创建node_modules文件夹 [英] npm install not creating node_modules folder

查看:4719
本文介绍了npm install没有创建node_modules文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想尝试运行npm install。在本地目录中,并继续收到这些错误:

I am just trying to run npm install . in a local directory, and keep getting these errors:

npm ERR! install Couldn't read dependencies
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "."
npm ERR! node v4.4.6
npm ERR! npm  v2.15.5
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a     package.json in
npm ERR! eisdir a package you are trying to install.

我正在做的就是进入我的目录并运行npm install。我也有一个packages.json文件。知道为什么这不起作用???
编辑:packages.json文件的内容如下:

All I'm doing is cd'ing into my directory and running npm install . I have a packages.json file in there, as well. Any idea why this isn't working??? contents of packages.json file is below:

{
  "name": "speech-recognition",
 "version": "1.0.0",
 "description": "speech recognition app",
 "main": "application.js",
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
   "start": "node server.js"
 },
 "author": "Lisa Buch",
 "license": "ISC"
 }


推荐答案

请检查您当前的目录。它应该包含一个具有适当结构和依赖关系的package.json文件。

Please check your current directory. It should contain a package.json file with proper structure and dependencies.

https://docs.npmjs。 com / files / package.json

如果您没有package.json文件,则意味着您从头开始创建项目。在这种情况下,您可以使用以下命令创建package.json文件。

If you don't have a package.json file, means you are creating a project from scratch. In this case you can create package.json file using following command.

npm init

并安装包,并使用npm install命令提供包名。例如如果你想安装快递包。使用以下命令

and install the packages with providing the package name with npm install command. e.g. if you want to install express package. use the following command

npm install express --save

这里--save选项将使用包及其版本更新package.json文件。

Here --save option will update you package.json file with the package and its version.

这篇关于npm install没有创建node_modules文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆