草庐IT

scripting-bridge

全部标签

node.js - 如何让 npm 运行 <script> 委托(delegate)给子 package.json?

我有2个级别的package.json文件。例子在这里:https://github.com/justin808/react-webpack-rails-tutorial原因是顶层是一个Rails应用程序,我将所有Node工具放在一个名为client的目录下,并带有它自己的package.json文件。顶级package.json文件是Nodebuildpack运行npminstall脚本的便利和Hook。我有一个转发gulp命令的示例。有什么方法可以将顶级package.json中未找到的任何内容普遍转发给子项?顶级package.json.{"name":"react-webpac

javascript - 在没有 "npm run x"条目的情况下实现 "scripts"行为?

在已安装的“上下文”中运行Node命令node_modules,您可以在scripts中输入领域package.json.例如:..."scripts":{"test":"mocha--recursivetest/**/*.js--compilersjs:babel-register"}...然后我可以输入npmruntest在我的项目根目录中,将运行mocha测试(通过调用安装在node_modules/mocha/bin中的mocha二进制文件)。有没有办法在不创建脚本条目的情况下实现完全相同的行为?例如,一次性的“脚本”?我正在想象类似以下的内容,相当于npmruntest:np

Node.js 虚拟机 : How to cancel Script. runInNewContext()?

我想使用vm模块作为运行外部代码的安全方式。它工作得很好,但还有一个问题:varUNKNOWN_CODE="while(true){}";varvm=require("vm");varobj={};varctx=vm.createContext(obj);varscript=vm.createScript(UNKNOWN_CODE);script.runInNewContext(ctx);console.log("finished");//neverexecuted有什么方法可以取消执行(例如,如果它持续超过5s)?提前致谢! 最佳答案

javascript - 如何从 React 中的 cdn/script 标签导入 javascript 包?

我想在React中导入这个javascript包但是,没有NPM包,所以我不能这样导入:importdwollafrom'dwolla'或importdwollafrom'https://cdn.dwolla.com/1/dwolla.js'所以每当我尝试dwolla.configure(...)我收到一条错误消息,指出dwolla未定义。我该如何解决?谢谢 最佳答案 转到index.html文件并导入脚本然后,在要导入dwolla的文件中,将其设置为变量constdwolla=window.dwolla;

javascript - 你如何运行多个 grunt scripts.postinstall?

我正在尝试从grunt的scripts.postinstall运行多个CLI命令。我不知道如何让两者都运行。如果我添加第二个命令都不会运行。它们分别在安装后和控制台中工作。我已经尝试将它们包装在一个数组中:"scripts":{"postinstall":["node_modules/.bin/bowerinstall","gruntsetup"]},我尝试用分号分隔它们:"scripts":{"postinstall":"node_modules/.bin/bowerinstall;gruntsetup"},我似乎在NPMScripts上找不到解决方案这些部分的gruntfile.j

javascript - grunt 找不到模块 'coffee-script'

我使用以下命令安装平均堆栈并创建应用程序:>sudonpminstall-gmeanio@latest//Getthemeancmdline>meaninitmyApp//createyourfirstapp>cdmyApp&&npminstall//Installdependencies>grunt//Launchmean但是当我到达最后的grunt命令时,我得到了错误:module.js:333throwerr;^Error:Cannotfindmodule'coffee-script'atFunction.Module._resolveFilename(module.js:331

node.js - npm "scripts": "start" run express and open url

我在package.json中有这个启动参数"scripts":{"start":"nodebin/www"},当我输入npmstart时,它正在运行我的express应用程序。但我希望浏览器同时打开http://localhost:8081。我怎么能对start说也打开我的本地url?like:"start":"nodebin/www,http://localhost:8081"所以当我输入npmsatrt时,它会运行我的快速应用程序并同时打开网址。 最佳答案 据我所知,这就像写一个bash命令://Windows"start":

javascript - 找不到模块 'coffee-script'

尝试使用TowerJS设置一个基本站点作为测试,但在运行脚手架生成器时遇到此错误。Macbook:appjohn$towergeneratescaffoldPosttitle:stringbody:textbelongsTo:user{[Error:Cannotfindmodule'coffee-script']code:'MODULE_NOT_FOUND'}module.js:340throwerr;^Error:Cannotfindmodule'/Users/john/Sites/tower/app/app/config/shared/application'atFunction.

javascript - 'react-scripts' 未被识别为内部或外部命令

我有一个maven项目,其中的JavaScript项目被克隆为一个git子模块。所以目录结构看起来像mavenapp/src/main/javascript/[npmprojectfiles]在我的package.json中,测试如下所示:"test":"react-scriptstest--env=jsdom",但是当我尝试运行npmtest时,它说'react-scripts'isnotrecognizedasaninternalorexternalcommand,有趣的是,当我独立克隆javascript项目时,我没有收到此错误。我试过重新运行npminstall。NPM版本:5

node.js - Node/ express : set NODE_ENV when using Forever to run script continuously

如何设置NODE_ENV当我使用forever时将变量/参数设置为“生产”启动我的Node脚本到目前为止我得到了这个:foreverstart-lforever.log-oout.log-eerr.log-aapp.js 最佳答案 你可以正常设置NODE_ENV然后永远运行:NODE_ENV=productionforever[flags]startapp.js[app_flags]当服务器重新启动时,初始的NODE_ENV将被保留-此问题中已修复的行为:https://github.com/nodejitsu/forever/is