草庐IT

experimental-modules

全部标签

node.js - 如何修复 'fs: re-evaluating native module sources is not supported' - 优雅的 fs

最近我切换到Nodev.6,它开始在运行正常构建grunt/gulp/webpack时产生越来越多的问题例如:$gulp[14:02:20]Localgulpnotfoundin~/_Other/angular-2-ts/angular2-seed[14:02:20]Tryrunning:npminstallgulp在/node_modules文件夹中安装gulp和所有其他插件和模块(甚至通过rm-rfnode_modules重新安装)。大多数错误都有类似的行(node:42)fs:re-evaluatingnativemodulesourcesisnotsupported.Ifyou

node.js - 无法让 Gulp 运行 : cannot find module 'gulp-util'

在Windows7上,我安装了gulp,如下所述:http://markgoodyear.com/2014/01/getting-started-with-gulp/:npminstallgulp-g在我的应用文件夹中:npminstallgulp--save-dev我创建了一个gulpfile.js文件。但是,当我尝试运行gulp时,我收到以下错误消息:module.js:340throwerr;^Error:cannotfilemodule'gulp-util'atFunction.Module._resolveFilename(module.js:338:15)等等但是gulp-

node.js - 在 Node.js 中声明多个 module.exports

我想要实现的是创建一个包含多个功能的模块。module.js:module.exports=function(firstParam){console.log("Youdidit");},module.exports=function(secondParam){console.log("Yesyoudidit");},//Thismaycontainmorefunctionsmain.js:varfoo=require('module.js')(firstParam);varbar=require('module.js')(secondParam);我遇到的问题是firstParam是一

node.js - NPM 全局安装 "cannot find module"

我写了一个模块,我刚才发布到npm(https://npmjs.org/package/wisp)所以它可以从命令行正常安装:$npmi-gwisp但是,当我从命令行运行它时,我不断收到一个未安装optimist的错误:$wispError:Cannotfindmodule'optimist'atFunction.Module._resolveFilename(module.js:338:15)atFunction.Module._load(module.js:280:25)atModule.require(module.js:362:17)atrequire(module.js:37

node.js - 错误 : Cannot find module '../lib/utils/unsupported.js' while using Ionic

我在运行“Ionic启动项目名称”时总是收到此错误消息:错误信息Runningcommand-failed![ERROR]Anerroroccurredwhilerunningnpminstall(exitcode1):module.js:471throwerr;^Error:Cannotfindmodule'../lib/utils/unsupported.js'atFunction.Module._resolveFilename(module.js:469:15)atFunction.Module._load(module.js:417:25)atModule.require(mo

node.js - 如何删除 node_modules - Windows 中的深层嵌套文件夹

在尝试删除npminstall创建的node_modules目录时:Thesourcefilename(s)arelargerthanissupportedbythefilesystem.Trymovingtoalocationwhichhasashorterpathname,ortryrenamingtoshortername(s)beforeattemptingthisoperation我也试过shift+delete仍然有同样的问题。 最佳答案 由于这是谷歌搜索结果中的佼佼者,这对我有用:更新,如果你有npmv5,请使用npx

node.js - Node.js 和 ES6 中的 module.exports 与 export default

Node的module.exports和ES6的exportdefault有什么区别?我试图弄清楚为什么在Node.js6.2.2中尝试exportdefault时出现“__不是构造函数”错误。什么有效'usestrict'classSlimShady{constructor(options){this._options=options}sayName(){return'MynameisSlimShady.'}}//Thisworksmodule.exports=SlimShady什么不起作用'usestrict'classSlimShady{constructor(options){

node.js - 如何包含位于 node_modules 文件夹中的脚本?

我有一个关于将node_modules包含到HTML网站的最佳做法的问题。想象一下,我的node_modules文件夹中有Bootstrap。现在对于网站的生产版本,我将如何包含位于node_modules文件夹中的Bootstrap脚本和CSS文件?将Bootstrap留在该文件夹中并执行以下操作是否有意义?或者我是否必须在我的gulp文件中添加规则,然后将这些文件复制到我的dist文件夹中?还是最好让gulp以某种方式从我的HTML文件中完全删除本地Bootstrap并将其替换为CDN版本? 最佳答案 通常,您不希望将任何内部路

node.js - 如何清理不在 package.json 中的包的 node_modules 文件夹?

假设我使用npminstall安装项目包,它会查看package.json以查找要安装的模块。过了一会儿,我发现我不需要某些特定模块并从package.json中删除它的依赖项。然后我从package.json中删除了一些其他模块,因为它们不再需要,而其他模块则替换为替代品。现在我想清理node_modules文件夹,以便只有package.json中列出的模块留在那里,其余的必须去,比如npmclean。我知道我可以手动删除它们,但希望有一些很好的准备使用糖功能。 最佳答案 我想你正在寻找npmprunenpmprune[[Thi

windows - 无法创建 Windows docker 机器? "Hyper-V PowerShell Module is not available"

我刚刚安装了docker并尝试创建一个Windows(不是Linux)的docker机器但是失败了?PSC:\>docker-machine.execreate--driverhypervdefaultCreatingCA:C:\Users\...\.docker\machine\certs\ca.pemCreatingclientcertificate:C:\Users\...\.docker\machine\certs\cert.pemRunningpre-createchecks...Errorwithpre-createcheck:"Hyper-VPowerShellModul