Tag: 节点模块

如何在节点源代码中findprocess.binding('..')中使用的源文件?

我想看到在nodeJS源代码中的process.binding()语句中提到的文件的源代码,在stackoverflow上看到类似的问题,但他们大多数回答像fs等具体情况。 我想解释一下,我应该能够findprocess.bindings()提到的任何文件。

npm错误代码ENOENT错误no-4058 npm无法find文件

这个问题几乎与每个npm模块的安装有关。 我认为这与SQLite 3模块有关,因为每当我使用npm init创build一个新项目,并安装SQLite 3以外的其他模块(比如crypto-js或yargs等),它就可以工作。 但是在安装SQLite 3之后不久,没有其他模块可以安装,并且发生以下错误。 我试图到处search,但无法find解决scheme。 我希望我能在这里find一个解决scheme。 我的Node版本是v8.2.1, npm版本是5.3.0。 我的操作系统是Windows 8.1 Professional。 F:\ name> npm install crypto -js –save npm WARN todo-api@1.0.0没有描述npm WARN todo-api@1.0.0没有版本库字段。 npm ERR! pathF:\ name \ node_modules \ sqlite3 \ node_modules \ node-pre-gyp \ node_module s \ npmlog \ node_modules \ are-we-there-yet \ node_modules \ delegates npm ERR! 代码ENOENT npm […]

如何在types中创build自己的节点模块时处理依赖关系

我正在尝试在打字稿中创build和发布节点模块。 我的库有一些我在package.json中添加的依赖关系。 { "name": "my-unite-framework", "version": "1.0.2", "description": "Can log \"hello world\" and \"goodbye world\" to the console!", "main": "dist/index.js", "types": "dist/index.d.ts", "dependencies": { "@angular/animations": "4.1.3", "@angular/common": "4.0.0", "@angular/compiler": "4.0.0", "@angular/compiler-cli": "4.0.0", "@angular/core": "4.0.0", "@angular/forms": "4.0.0", "@angular/http": "4.0.0", "@angular/platform-browser": "^4.3.6", "@ionic-native/core": "^4.2.0", "@ionic-native/network": "^3.4.4", "@ionic/storage": "^2.0.1", "ionic-angular": "3.0.1", "ionic-cache": "^2.0.4", "ng2-translate": "^5.0.0", "rxjs": "5.1.1" } […]

使用Node JS中的节点caching模块,设置后无法获取数据

Node.js版本:v6.10.3操作系统:Windows 我正在尝试使用Node JS实现caching。 使用节点caching模块。 我使用下面的代码将数据设置为caching并从caching中获取数据。 const NodeCache = require( "node-cache" ); const myCache = new NodeCache( { stdTTL: 3000, checkperiod: 3000} ); obj = { my: "Special", variable: 42 }; myCache.set( "myKey", obj ); // Calling DB, fetch the data and set in to cache for first time when client requests. value = myCache.get( "myKey" […]

共享模块无法parsing其依赖关系

我正在运行摩卡testing共享模块的问题。 问题在于,它位于其层次结构中没有node_modules的文件夹中,因此节点无法parsing模块的依赖关系。 结构如下: repo └ project_1 └ node_modules └ project_2 └ node_modules └ shared └ my_module.js 这样共享模块可以被两个项目使用。 在运行/构build项目时,共享模块将复制到项目下,以便他们可以在项目的node_modules文件夹中find它们的依赖关系。 但是,当运行mocha时,这些文件不会被复制,所以模块parsing无法find依赖关系。 对于所有项目,我可以有一个顶级的node_modules文件夹,但每个项目都有自己的package.json时可以使用这个文件夹吗? 或者,你可以给节点/摩卡path的node_modules寻找pathparsing? 有$ NODE_PATH envvariables,但它感觉不切实际,因为我将不得不改变它与项目我testing。 有这样的事情的一些最佳做法?

无法parsing模块“react”

我克隆了https://github.com/oblador/react-native-progress 在示例文件夹上: npm i react-native run-ios 但是我得到一个错误,这是错误screenshoot链接: Unable to resolve module react 这是代码: import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Animated, Easing, View, ViewPropTypes, } from 'react-native'; 为什么我的react模块不能解决,但react native模块可以?

Node.js发行w / Engine.io

我在处理服务器端节点脚本时遇到问题。 我有一个VPS和运行节点app.js在我的网站1的其他虚拟文件夹中工作得很好。 但是,当我在我的网站2虚拟文件夹中运行节点app.js它说 /home/website2/node_modules/engine.io/node_modules/uws/uws.js:3 const http = require('http'); ^^^^^ SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Server.init (/home/website2/node_modules/engine.io/lib/server.js:115:16) at new Server (/home/website2/node_modules/engine.io/lib/server.js:65:8) at Function.attach (/home/website2/node_modules/engine.io/lib/engine.io.js:123:16) at Server.initEngine (/home/website2/node_modules/socket.io/lib/index.js:274:21) 首先,我会的 cd /home/website2 那我就去 node app.js 这显示了上面的错误,但是当我 cd […]

Sails.js 1.0打破新安装

我使用Sails 1.0没有问题。 当这个问题开始时,我没有在PC上安装或删除任何新东西。 我重新安装了Windows,仍然有同样的问题: dvs@dvs-PC MINGW64 /d/ $ clear dvs@dvs-PC MINGW64 /d/ $ node -v v6.11.5 dvs@dvs-PC MINGW64 /d/ $ npm install sails@beta -g C:\Users\dvs\AppData\Roaming\npm\sails -> C:\Users\dvs\AppData\Roaming\npm\node_modules\sails\bin\sails.js C:\Users\dvs\AppData\Roaming\npm `– sails@1.0.0-38 dvs@dvs-PC MINGW64 /d/ $ sails new exampleproject C:\Users\dvs\AppData\Roaming\npm\node_modules\sails\node_modules\machine\lib\private\help-build-machine.js:1237 );//parley(…) ^ SyntaxError: Unexpected token ) at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js […]

升级节点,但得到“SyntaxError:在严格模式下使用const”错误

我在Amazon Linux上运行以下版本的节点和npm … [myuser@mymachine ~]$ node –version v8.8.1 [myuser@mymachine ~]$ npm -v 5.4.2 通过安装我的seleniuv-webdriver模块后 npm install selenium-webdriver 我正在运行我的nodeJStesting,但得到以下错误 /home/jboss/node_modules/selenium-webdriver/index.js:25 const chrome = require('./chrome'); ^^^^^ SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/jboss/.jenkins/workspace/myco/automated-tests/nodejs/js/js-FF/Optimus-FF.js:2:15) at Module._compile (module.js:456:26) […]

在使用中使用Angular 4中的node_module(网站刮板)失败

目前我正在尝试将node_module“网站刮板”[1]添加到我的Angular 4项目中。 我通过“npm install website-scraper -save”下载安装模块。 在我的组件我导入模块“导入*作为刮刀从'网站刮板'”。 到目前为止,所有东西都按预期编译 如果我现在只是添加“console.log(Scraper)”在我的组件的某处,我得到警告[3],我的浏览器抛出错误[2] 有人可以启发我,出了什么事? 我使用节点8.9.0和npm 5.5.1。 无论如何,我尝试多个furhter(旧)版本的节点和npm导致相同的行为。 任何帮助表示赞赏。 提前致谢。 [1] https://www.npmjs.com/package/website-scraper [2] graceful-fs.js:166 Uncaught TypeError: Cannot read property 'prototype' of undefined at patch (graceful-fs.js:166) at Object.eval (graceful-fs.js:27) at eval (graceful-fs.js:262) at Object…/../../../graceful-fs/graceful-fs.js (vendor.bundle.js:884) at __webpack_require__ (inline.bundle.js:55) at eval (index.js:4) at Object…/../../../fs-extra/lib/fs/index.js (vendor.bundle.js:726) at __webpack_require__ (inline.bundle.js:55) at eval (index.js:8) at […]