Impossible d'exécuter babel via npm script “babel: command not found”

Pour commencer, j'ai couru:

npm install --save-dev babel-cli
npm install --save-dev babel-preset-es2015
npm install --save-dev babel-preset-stage-0 

Ici est mon colis.json:

   {
      "scripts": {
        "build": "babel src -d dist"
      },
      "devDependencies": {
        "babel-cli": "^6.6.5",
        "babel-core": "^6.7.2",
        "babel-preset-es2015": "^6.6.0",
        "babel-preset-stage-0": "^6.5.0"
      }
    }

Voici mon .babelrc fichier:

{
  "presets": ["es2015", "stage-0"]
}

Mon fichier de structure comme ceci:

- Root
    - src
        - client 
        - server
        - test  
    - dist 
    - package.json

Je fais appel mnp exécuter construire à partir du dossier racine. Je m'attends à compiler les sources de dossier dans le dossier dist. Il s'exécute, et puis j'ai cette erreur:

> babel src -d dist

sh: babel: command not found

npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v5.8.0
npm ERR! npm  v3.7.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! redacted@1.0.0 build: `babel src -d dist`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the redacted@1.0.0 build script 'babel src -d dist'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the redacted package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     babel src -d dist
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs redacted
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls redacted
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/user/redacted/npm-debug.log

Donc, comme vous pouvez le voir, j'ai installé babel-cli, je l'ai installé les presets, et je pense que tout est en ordre selon la babel docs.

Quelqu'un a des idées sur pourquoi il ne serait pas de travail? Pourrais-je être absente de babel mnp fichier? Est "babel src -d dist" incorrect?

Merci pour toute aide que vous pouvez fournir!

J'ai fait un autre dossier, et a suivi les mêmes étapes, il a parfaitement fonctionné. Pour une raison qu'il ne fonctionne pas dans ce répertoire.

Avez-vous fait 'npm-je'? Pouvez-vous voir dans node_modules?
oui, j'ai! Pour chacun, je n'ai mnp installer et à utiliser --save-dev

OriginalL'auteur Justin | 2016-03-19