npm找不到package.json

我试图安装我下载的一些示例Express应用程序的依赖关系,但所有的应用程序都抛出相同的错误:

c:\node\stylus>npm install -d npm info it worked if it ends with ok npm info using npm@1.1.1 npm info using node@v0.6.11 npm ERR! Couldn't read dependencies. npm ERR! Error: ENOENT, no such file or directory 'c:\node\stylus\package.json' npm ERR! You may report this log at: npm ERR! <http://github.com/isaacs/npm/issues> npm ERR! or email it to: npm ERR! <npm-@googlegroups.com> npm ERR! npm ERR! System Windows_NT 6.1.7600 npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-d" npm ERR! cwd c:\node\stylus npm ERR! node -v v0.6.11 npm ERR! npm -v 1.1.1 npm ERR! path c:\node\stylus\package.json npm ERR! code ENOENT npm ERR! message ENOENT, no such file or directory 'c:\node\stylus\package.json' npm ERR! errno {} npm ERR! npm ERR! Additional logging details can be found in: npm ERR! c:\node\stylus\npm-debug.log npm not ok 

有谁知道这个问题的根源是什么?
我在跑:

  • Windows 7 64位
  • npm 1.1.1
  • 节点6.11
  • expression2.5.8

我想你忘了设置快速目录:

 express <yourdirectory> 

一旦你这样做,你应该能够看到一堆文件,你应该运行命令:

 npm install -d 

问候。

我会简短但致命。 :)安装-D不会为你工作。 这很简单。 尝试

 $ npm install -g express 

我想'npm init'会创build你丢失的package.json文件。 它适用于我的情况。

通过下面的步骤,您可以获得package.json文件。

 npm --version npm install express npm init -y 

链接: http : //www.codingslover.com/2017/02/npm-node-js-cant-find-packagejson.html

如果谷歌search“没有这样的文件或目录package.json”发送给你在这里,那么你可能会使用一个非常旧的版本的Node.js

以下页面对如何在许多操作系统和发行版上轻松安装最新稳定版有很好的说明:

https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

使用win7 / win8 / win10(CD)中的命令移动文件夹:

  1. input你的项目文件夹

  2. 运行: npm install -d

我的问题是由于某种原因我没有package.json文件。 在我把这个文件放入我的目录之后,我可以运行npm install

https://raw.githubusercontent.com/twbs/bootstrap/master/package.json

尝试重新安装Node.js

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -

sudo apt-get install -y nodejs

 sudo apt-get install -y build-essential 

并更新npm

 curl -L https://npmjs.com/install.sh | sudo sh 

看来试图将npm安装在未初始化的npm包目录中。

你应该初始化包:

npm init

我希望它有帮助!

这可能是非常明显的,
但是尝试 package.json文件所在的项目文件夹中启动CMD (对于Windows)。

不要从系统或Win或Windows中的“search栏”启动CMD
cd命令的帮助下移至您的项目文件夹,然后启动npm start

节点与npm安装,所以你应该有一个版本的NPM。 但是,npm会比Node更频繁地更新,因此您需要确保它是最新的版本。

 sudo npm install npm -g 

testing:

 npm -v //The version should be higher than 2.1.8 

之后,你应该可以运行:

 npm install 

对于下面的命令

 sudo npm install react browserify watchify babelify --save-dev 

我有同样的错误

saveError ENOENT:没有这样的文件或目录,打开“/Users/Path/package.json”

但是当我运行命令

 sudo npm install -gd react browserify watchify babelify --save-dev 

那么不会出现丢失的文件或目录消息。

谢谢! 我也尝试了很多select。 我也使用windows.This命令帮助和节省了我的时间:

 npm install -g npm@lts 

我已经运行npm install -y跳过创build丢失的文件package.json的问题步骤, y表示是

好吧,试着去家里“user @ user:〜$”(cd + enter键),然后npm install -g your_module。

在包名称为我工作之前添加-g。 寻找文件来解释为什么这个工程..

我在安装打字稿时也面临同样的问题。 我刚刚通过以下命令初始化一个package.josn文件

 npm init -y 

然后我安装了我的打字稿

 npm install -g -typescript 

http://blossomprogramming.blogspot.com/