NPM不创建.bin目录 [英] NPM not creating .bin directory

查看:358
本文介绍了NPM不创建.bin目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Mac OS X 10.9.2 上使用 npm v1.4.4 节点v0.10.25 .

我最近升级了节点和npm,现在npm install不再在node_modules中创建.bin目录.

I've recently upgraded node and npm, and now npm install is no longer creating the .bin directory in node_modules.

我已经删除了node_modules,再次尝试了npm install,但是从未创建目录和二进制文件.

I've deleted node_modules, tried npm install again, but the directory and binaries are never created.

有人对发生这种情况的原因有任何想法吗?

这是我的package.json:

{
  "name": "redacted",
  "author": {},
  "description": "redacted",
  "dependencies": {
  },
  "devDependencies": {
    "karma": "*",
    "karma-coverage": "0.1.2",
    "karma-junit-reporter": "*",
    "karma-coffee-preprocessor": "~0.1",
    "grunt": "^0.4.2",
    "grunt-contrib-requirejs": "^0.4.3",
    "grunt-contrib-concat": "^0.3.0",
    "grunt-contrib-sass": "^0.7.2",
    "grunt-contrib-htmlmin": "^0.2.0",
    "grunt-contrib-cssmin": "^0.7.0",
    "grunt-contrib-coffee": "^0.10.1",
    "grunt-contrib-uglify": "^0.3.3",
    "grunt-contrib-jst": "^0.5.1",
    "grunt-contrib-qunit": "^0.4.0",
    "grunt-contrib-jshint": "^0.8.0",
    "grunt-contrib-watch": "^0.5.3",
    "grunt-contrib-jasmine": "^0.6.1",
    "grunt-contrib-compress": "^0.6.1",
    "grunt-contrib-handlebars": "^0.6.1",
    "grunt-contrib-less": "^0.9.0",
    "grunt-contrib": "^0.9.0"
  }
}

推荐答案

./node_modules/.bin目录是npm创建到节点程序包二进制文件的链接的位置.来自 https://docs.npmjs.com/files/folders#executables

The ./node_modules/.bin directory is where npm creates links to a node package's binary. From https://docs.npmjs.com/files/folders#executables

可执行文件

在全局模式下,可执行文件链接到 在Unix上为{prefix}/bin,在Windows上为{prefix}.

Executables

When in global mode, executables are linked into {prefix}/bin on Unix, or directly into {prefix} on Windows.

在本地模式下,可执行文件链接到./node_modules/.bin中,因此 使其可用于通过npm运行的脚本. (为了 例如,这样,当您运行npm时,测试跑步者将在路径中 测试.)

When in local mode, executables are linked into ./node_modules/.bin so that they can be made available to scripts run through npm. (For example, so that a test runner will be in the path when you run npm test.)


您上面粘贴的package.json没有bin部分.从npmpackage.json


The package.json you pasted above do not have a bin section. Take a look at this example from npm's package.json

{
  "version": "1.4.9",
  "name": "npm",
  "publishConfig": {
    "proprietary-attribs": false
  },
  "description": "A package manager for node",
  ...
  ...
  "main": "./lib/npm.js",
  "bin": "./bin/npm-cli.js",
  "dependencies": {
    "abbrev": "~1.0.4",
    "ansi": "~0.2.1",
    ...
    ...

具体来说,行"bin": "./bin/npm-cli.js"将告诉npm./node_modules/.bin/npmnode_modules/npm/npm-cli.js

Specifically the line "bin": "./bin/npm-cli.js" will tell npm to create a link at ./node_modules/.bin/npm to node_modules/npm/npm-cli.js

这篇关于NPM不创建.bin目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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