Tag: npm

我可以从运行Node.js的JavaScript安装一个NPM包吗?

我可以从运行在Node.js中的JavaScript文件安装NPM包吗? 例如,我想要一个脚本,让我们称之为“script.js”,以某种方式(…使用NPM或…)安装通常可通过NPM的包。 在这个例子中,我想安装“FFI”。 (npm install ffi)

什么导致“咕噜咕噜”扔“没有find凉亭组件”?

我在我的Windows 7盒子里开始使用angular-fullstack的angular度应用程序。 我用-g选项安装了一堆npm包,包括grunt-bower-install。 我首先通过运行创build了应用程序 哟angular-fullstack appname 应用程序创build过程中没有任何exception。 应用程序创build成功后,我试图运行应用程序使用 咕噜服务 期待服务器运行。 但“咕噜咕噜”失败了 运行“bower-install:app”(bower-install)任务无法find保存Bower软件包的位置。 我们试图寻找.bowerrc文件,但找不到定义的自定义directory属性。 然后我们尝试了bower_components ,但是看起来也不存在。 作为最后的手段,我们尝试了1.0之前的components目录,但也找不到。 不幸的是,我们无法知道您安装的Bower软件包的位置。 致命错误:找不到Bower组件。 我find了.bowerrc文件,它指向了app / bower_components。 不幸的是,bower_components文件没有find。 我不知道该自己创build文件的内容应该是什么。 这是缺less的文件导致这个问题,还是有一个NPM包,我没有正确安装? 我使用npm安装了bower * 谢谢

更改node_modules位置

有没有办法改变node_modules文件夹的位置? 例如: – dir1 – dir2 – node_modules 至: – dir1 – dir2 – node_modules

NPM忽略.gitignore中列出的文件吗?

我有一个由npm install命令生成的文件(使用preinstall任务)。 我不想把它添加到git仓库中,也不在NPM项目中。 假设文件名是foo.json ,我将它作为foo.json添加到.gitignore文件中。 这是否足以避免上传到NPMregistry? 我知道我可以添加.npmignore文件,肯定会忽略该文件,但我不会添加它,如果.gitignore已经这样做。

如何清除纱线中的caching?

我正在为Facebook的纱线做一些基准testing。 为此,我需要清除我的全局Yarncaching。 有没有可用的命令? 我强制删除我的~/.yarn-cache文件夹,但是这似乎是相当手动的。

运行摩卡testing时,Babel意外的令牌导入

在其他相关问题中提供的解决scheme,例如在.babelrc中包含正确的预设(es2015),已经在我的项目中实现。 我有两个项目(让我们称之为A和B)都使用ES6模块语法。 在项目A中,我正在导入通过npm安装的项目B,并且位于node_modules文件夹中。 当我运行我的testing套件的项目A,我收到错误: SyntaxError:意外的标记导入 项目B中这个所谓的错误的代码行之前: (函数(exports,require,module,__filename,__dirname){从'history / lib / createBrowserHistory'导入createBrowserHistory; 因为我的源文件只包含“history / lib / createBrowserHistory”导入createBrowserHistory;项目B的testing套件中的unit testing运行良好,如果我作为依赖从项目B中删除项目项目A,我的testing套件(仍然使用es6导入内部项目模块)工作得很好。 全堆栈跟踪: SyntaxError: Unexpected token import at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at Module._extensions..js (module.js:405:10) at Object.require.extensions.(anonymous function) [as .js] (/ProjectA/node_modules/babel-register/lib/node.js:138:7) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object.<anonymous> (actionCreators.js:4:17) at Module._compile (module.js:398:26) […]

更新鲍尔到最新版本的问题

我正在使用凉亭 $ bower -v 0.9.2 鲍尔的最新版本是1.xx https://github.com/bower/bower/releases 我运行更新凉亭到最新版本 npm update -g bower 这没有帮助 我还有 $ bower -v 0.9.2

使用npm + package.jsonpipe理cordova插件

我们有一个Angular + Ionic + Cordova项目和多个开发者,我们想要pipe理cordova插件依赖关系。 我们使用的是Cordova CLI 5+ ,当手动运行安装命令(例如, cordova plugin add cordova-plugin-camera )时,会在package.json文件的cordovaPlugins部分添加一个新行。 以下是成品的外观: "cordovaPlugins": [ "cordova-plugin-camera", "cordova-plugin-console", "cordova-plugin-contacts", "cordova-plugin-device", "cordova-plugin-dialogs", "cordova-plugin-file", "cordova-plugin-geolocation", "cordova-plugin-media", "cordova-plugin-media-capture", "cordova-plugin-network-information", "cordova-plugin-splashscreen", "cordova-plugin-statusbar", "cordova-plugin-vibration", "com.ionic.keyboard" ] 这一切都很好,除了我们无法find开发#2到npm安装这些插件的任何方式 – 相反,他必须单独运行这些命令,然后将一个重复的行添加到package.json ,污染存储库。 我们确定必须有一个命令来安装这些,但无法find它。 任何人都可以点亮一下吗?

在Windows上运行Npm时如何解决SSL证书错误?

当我尝试用npm安装包时,它不起作用。 经过漫长的等待,我最终得到一个错误'隧道套接字无法build立,sutatusCode = 403'。 $ npm install coffee-script npm http GET https://registry.npmjs.org/coffee-script npm http GET https://registry.npmjs.org/coffee-script npm http GET https://registry.npmjs.org/coffee-script npm ERR! Error: tunneling socket could not be established, sutatusCode=403 npm ERR! at ClientRequest.onConnect (c:\Program Files\nodejs\node_modules\npm\node_modules\request\tunnel.js:148:19) npm ERR! at ClientRequest.g (events.js:193:14) npm ERR! at ClientRequest.EventEmitter.emit (events.js:123:20) npm ERR! at Socket.socketOnData (http.js:1393:11) npm ERR! at TCP.onread […]

如何安装grunt以及如何使用它构build脚本

嗨,我想安装在Windows 7 64位Grunt。 我已经使用命令安装了Grunt npm install -g grunt npm install -g grunt-cli 但是现在,如果我尝试去做一些grunt init ,它会抛出一个错误 – 无法find有效的Gruntfile。 请参阅入门指南以获取有关如何configurationgrunt的详细信息: http ://gruntjs.com/getting-started致命错误:无法findGruntfile。 但是当我在我的系统上看到grunt文件夹时, Gruntfile.js就在那里。 有人可以请指导我如何正确安装此咕噜声,以及如何使用咕噜声编写内置脚本。 我有一个HTML页面和Java脚本,如果我想用Grunt构build脚本,我该怎么做?