Tag: npm install

指定应该在package.json中安装没有可选依赖的软件包

我写了Discord的聊天机器人,它使用了discord.io库。 虽然这个库支持与语音相关的自动化,但是通过使用–no-optional开关可以防止这些function的安装,从而节省了大量的带宽和时间。 npm install discord.io –save –no-optional 到目前为止这么好,但是否使用这个选项, package.json和可选依赖项之间没有区别,因此当有人继续部署我的机器人时,他们会下载并安装所有的我不使用的不必要的语音模块。 有没有任何一种解决scheme,导致所说的软件包被安装没有可选的依赖关系,当npm install在项目文件夹中运行?

npm列表如何知道哪些是直接依赖关系?

在input以下三个命令之后直接进入一个新的命令: npm install underscore npm install lodash npm install express 我得到一个包含许多软件包的node_modules目录: $ ls node_modules accepts cookie-signature encodeurl forwarded lodash mime-db parseurl send underscore array-flatten debug escape-html fresh media-typer mime-types path-to-regexp serve-static unpipe content-disposition depd etag http-errors merge-descriptors ms proxy-addr setprototypeof utils-merge content-type destroy express inherits methods negotiator qs statuses vary cookie ee-first finalhandler ipaddr.js mime […]

在本地安装JSBin

我想跟随这个页面在本地运行JSBin。 我在我的Mac中安装了xcode 8.2 。 现在, npm -v返回3.10.9 ; node -v返回v7.2.1 。 在git clone git@github.com:remy/jsbin.git和cd jsbin ,我修改了package.json ,使其具有"memcached": "2.2.2" (参见本线程 ),然后npm install返回 /Users/softtimur/Startup/WebProjects/tmp/jsbin$ npm install npm WARN deprecated jade@1.4.2: Jade has been renamed to pug, please install the latest version of pug instead of jade npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher […]

如何将Android支持添加到我的Ionic应用程序项目?

我创build了一个离子应用程序项目。 我想添加Android支持到我的应用程序。 为此,我使用了“离子平台添加Android”,但是我的系统显示了一些错误,我正在使用Windows机器。 Adding android project… Running command: cmd "/s /c "C:\Users\SYSTEM-03\.cordova\lib\npm_cache\cordova-android\6.0.0\package\bin\create.bat E:\workspace\appstore\demoapp\platforms\android com.ionicframework.demoapp722446 demoapp –cli"" C:\Users\SYSTEM-03\.cordova\lib\npm_cache\cordova-android\6.0.0\package\bin\templates\cordova\lib\AndroidStudio.js:16 for(file of eclipseFiles) { ^^ SyntaxError: Unexpected identifier 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> (C:\Users\SYSTEM-03\.cordova\lib\npm_cache\cordova-android\6.0.0\package\bin\templates\cordova\lib\AndroidProject.js:24:21) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32)

Heroku应用程序没有使用正确的节点模块

我试图在我的Heroku应用程序上testing一个节点模块的分支。 以下是我所做的: 分叉节点模块回购,并对代码进行了一些更改。 推到我自己的远程回购。 在我的Heroku bashterminal上运行以下内容: npm install git+https://git@github.com/Nsrose/node_model_updated.git 冉heroku重新启动。 这实际上更新了我在node_modules /文件夹下编辑的文件。 但是,此文件更改修复的错误不会更改。 在npm安装之前,应用程序说这个错误: 错误TypeError:无法读取未定义的属性“通道”(第97行) 在上述一系列命令之后,即使文件在node_modules /下的heroku服务器上更新,错误依然存在。 实际上,我现在改变的文件甚至没有任何与97行上的“频道”有关的东西。 为什么我的heroku应用仍在使用旧的node_module /以及如何强制更新?

强制安装npm以安装其他平台的可选依赖项

我正在构buildVisual Studio Team Services的构build任务。 在这个任务中,我正在使用7zip-bin为Linux,Mac和Windows打包7zip的二进制文件。 这是非常好的,如果我有能力只将package.json部署到构build服务器,但是没有…构build任务包含构build时的所有依赖关系,它将工作。 有没有办法强制npm下载所有操作系统可选软件包? 或者我将不得不在构build期间自己下载文件并提取它? 现在我正在使用 npm install 7zip-bin –save 其结果是: C:\temp>npm install npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-linux@^1.0.3 (node_modules\7zip-bin\node_modules\7zip-bin-linux): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-linux@1.0.3: wanted {"os":"linux","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-mac@^1.0.1 (node_modules\7zip-bin\node_modules\7zip-bin-mac): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for […]

减less用于生产的node_modules的大小

我创build了node_modules,用于在ngrok的帮助下从本地主机上载addon到在线网站,并在CommandPrompt中使用npm install 。 但创build的node_modules文件夹大小为78mb。 在这种情况下,我必须通过删除不需要的文件夹来缩小文件大小,所以我在网上冲浪,并得到了两个build议,因为减小文件大小可能是有效的,它们是:使用– 生产模式 ,另一种使用收缩包装 。 作为第一步,我使用命令npm install –production和npm install –only = production(如下所示): 如何防止为Node.js(package.json)安装“devDependencies”NPM模块? ,但我没有看到文件夹大小的任何变化。 然后介绍如何使用shrinkwrap缩小本网站给出的尺寸,并尝试使用: https : //docs.npmjs.com/cli/shrinkwrap ,但没有成功。 另外我在这里提到: https : //www.npmjs.com/package/modclean ,使用命令modclean -n默认:安全我得到了10-11mb减less。 但是,我仍然在node_modules中有大量不需要的文件夹。 我已经在package.json中指定了一些需要的依赖项,如下所示, "dependencies": { "atlassian-connect-express": "2.0.0", "body-parser": "^1.14.2", "compression": "^1.6.0", "cookie-parser": "^1.4.0", "errorhandler": "^1.4.2", "express": "^4.13.3", "express-hbs": "*", "jugglingdb-sqlite3": "0.0.5", "morgan": "^1.6.1", "static-expiry": ">=0.0.5" } 我在package.json中给出的依赖很less,但我看到在node_modules中创build了大量文件夹。 我怎样才能减lessnode_modules的大小,还有其他的进程吗?

“npm install -g xxx”安装到什么地方?

例如, npm install -g sinopia 在windows7上,我将在C:\ Users \ xxxx \ AppData \ Roaming \ npm中安装sinopia命令和相关模块。 在Redhat5上,我的节点和npm命令位于/usr/local/clo/ven/node-v4.2.3-linux-x64/bin。 当我运行'npm install -g sinopia'时,默认情况下,sinopia被安装在当前目录下,如下所示。 但是目前我有一台装有其他人装的sinopia的linux机器。 我在node / bin里找不到sinopia的启动脚本,我可以在下面findsinopia相关的东西。 。 我在哪里可以findsinopia的开始脚本? 是否可以configuration'npm install -g xxx'的安装位置?

浏览一个包含没有.js类的节点模块的文件

我正在尝试浏览我的模块。 我有一个依赖于这个https://www.npmjs.com/package/chilkat_win32它在我的node_modules文件夹中,这是它的结构看起来如何。 如你所见,没有js课。 但是有一个.node文件。 当我在我的模块上运行browserify时出现以下错误。 SyntaxError: Unexpected character ' ' (2:2) while parsing G:\Projects\Kube 2.0\edge-node-sdk-typescript\edge-node-sdk-js\node_modules\chilkat_win32\chilkat.node while parsing file: G:\Projects\Kube 2.0\edge-node-sdk-typescript\edge-node-sdk-js\node_modules\chilkat_win32\chilkat.node at DestroyableTransform.end [as _flush] (C:\Users\macilamanym\AppData\Roaming\npm\node_modules\browserify\node_modules\insert-module-globals\index.js:96:21) at DestroyableTransform.<anonymous> (C:\Users\macilamanym\AppData\Roaming\npm\node_modules\browserify\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:115:49) at DestroyableTransform.g (events.js:260:16) at emitNone (events.js:67:13) at DestroyableTransform.emit (events.js:166:7) at prefinish (C:\Users\macilamanym\AppData\Roaming\npm\node_modules\browserify\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:465:12) at finishMaybe (C:\Users\macilamanym\AppData\Roaming\npm\node_modules\browserify\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:473:7) at endWritable (C:\Users\macilamanym\AppData\Roaming\npm\node_modules\browserify\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:485:3) at DestroyableTransform.Writable.end (C:\Users\macilamanym\AppData\Roaming\npm\node_modules\browserify\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:455:41) at DestroyableTransform.onend (C:\Users\macilamanym\AppData\Roaming\npm\node_modules\browserify\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:495:10) 这是因为.node文件无法读取或浏览? 如果是这样,我该如何应对这个模块,并浏览我的模块? 请指教。 […]

只有在尚未安装的情况下如何全局安装npm包?

我正在编写一个构build脚本,它执行如下命令: npm install bower -g npm install gulp -g 即使已安装这些软件包,在我的机器上安装这些软件包大约需要30-60秒(例如,从以前的构build脚本运行中安装)。 我想可能有一种方法来检测是否已经安装了bower或gulp ,在这种情况下跳过安装来节省一些时间。 是这样的可能吗? 我该怎么做? 我使用Windows和PowerShell,但我想在bash中的一些解决scheme可能可以移植到Windows …