我如何使用本地版本的模块node.js.例如,在我的应用程序中,我安装了coffee-script:
npm install coffee-script
Run Code Online (Sandbox Code Playgroud)
这将安装它./node_modules并且coffee命令在./node_modules/.bin/coffee.当我在项目的主文件夹中时,有没有办法运行此命令?我想我正在寻找类似于bundle exec捆绑器的东西.基本上,我想指定一个与项目有关的每个人都应该使用的咖啡脚本版本.
我知道我可以添加-g标志来全局安装它,这样咖啡在任何地方都可以正常工作,但如果我想在每个项目中使用不同版本的咖啡呢?
我有这个代码:
"use strict";
import browserSync from "browser-sync";
import httpProxy from "http-proxy";
let proxy = httpProxy.createProxyServer({});
Run Code Online (Sandbox Code Playgroud)
我通过npm 安装babel-core并babel-cli全局安装.关键是当我尝试在终端上使用它编译时:
babel proxy.js --out-file proxified.js
Run Code Online (Sandbox Code Playgroud)
输出文件被复制而不是编译(我的意思是,它与源文件相同).
我在这里错过了什么?
我按照这里的指示安装babel-cli.我"build": "babel src -d lib"在我想要运行它的目录中添加到我的package.json中.但是,在运行时,我收到此错误:
npm run build
> ipfs-readme-standard@1.0.0 build /Users/richard/src/ipfs-readme-standard
> babel src -d lib
src doesn't exist
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/richard/.nvm/versions/node/v5.0.0/bin/node" "/Users/richard/.nvm/versions/node/v5.0.0/bin/npm" "run" "build"
npm ERR! node v5.0.0
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! ipfs-readme-standard@1.0.0 build: `babel src -d lib`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the ipfs-readme-standard@1.0.0 build script 'babel src -d lib'.
npm ERR! Make sure …Run Code Online (Sandbox Code Playgroud) 我需要帮助才能找到Windows计算机上的Babel版本。我已经使用安装了它
npm install --save-dev babel-cli babel-preset-env.
Run Code Online (Sandbox Code Playgroud)
如何检查Windows操作系统上的版本?