无论我在什么目录下,无论我在cmd.exe中键入“npm”后,我都被这个错误卡住了。下面是npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js' ]
2 info using npm@2.14.12
3 info using node@v4.2.6
4 verbose stack Error: EISDIR: illegal operation on a directory, read
4 verbose stack     at Error (native)
5 verbose cwd C:\Users\me
6 error Windows_NT 6.1.7601
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"
8 error node v4.2.6
9 error npm  v2.14.12
10 error code EISDIR
11 error errno -4068
12 error syscall read
13 error eisdir EISDIR: illegal operation on a directory, read
13 error eisdir This is most likely not a problem with npm itself
13 error eisdir and is related to npm not being able to find a package.json in
13 error eisdir a package you are trying to install.
14 verbose exit [ -4068, true ]

I have tried and uninstalling/reinstalling nodejs multiple times, I even deleted npm and npm-cache folders in C:\Users\me\AppData\Roaming. I'm not sure what went wrong to cause this. One second it was working fine, and now I can't get rid of this error. The explanation in the log does not make sense, as it gives this error in any directory. I should note that running a command prompt as administrator does not give this error. I'm pulling my hair out this Friday evening trying to get this fixed, any help would be greatly appreciated!


当前回答

检查确保你在正确的目录下运行npm install。

(包。Json文件可以是一个额外的目录下,例如。)

其他回答

在我的情况下,我的错误是假设,脚本允许与目录一起工作,但它等待FILE PATH,所以尝试设置文件的完整路径。

我的情况是:

['/var/task/myFolder']

但正确的道路应该是:

['/var/task/myFolder/sample.tgs']

与无服务器上木偶机内部铬使用相关的项目是lambda。希望,它有帮助。

我也有同样的问题。

最近刚刚删除了用户目录中的.npmrc文件,之后,我运行了npm init -y

作品!

在我的情况下,我忘记传递它所要求的一个文件的完整路径。在传递文件的完整路径后工作:)

我通过移动我的目录从我的exFAT驱动器不支持符号链接修正了这个问题。

我的exFat驱动器在osx和bootcamp窗口分区之间共享,所以当我试图克隆和npm安装我的项目时,它失败了,但从未解释exFat不支持此功能。

你可以安装一些驱动程序来添加符号链接的功能,但与运行一个简单的npm脚本相比,你必须手动进行大量的设置。

我有吞咽的问题。问题是gulp添加了一个依赖到我的源文件,我认为npm试图打开它:

{
  "name": "name",
  "version": "2.0.0",
  "description": "",
  "main": "gulpfile.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "appname": "file://gulp",
    "gulp-concat": "^2.6.1",
    "gulp-electron": "^0.1.3",
    "gulp-shell": "^0.5.2",
    "gulp-uglify": "^2.0.0",
    "gulp-util": "^3.0.7",
    "node-7z": "^0.4.0"
  }
}

确保你的包中没有奇怪的引用。json文件。