首页 \ 问答 \ 无法安装快递和套餐(Can't install express and packages)

无法安装快递和套餐(Can't install express and packages)

在此处输入图像描述

在此处输入图像描述

嘿,对不起,如果这个问题很荒谬,但是我无法处理nodeJS中的启动,我尝试安装npm install -gn global并尝试在本地安装快速但我不能这样做,我正在尝试安装快递,就像那个npm install express在设置我的本地路径之前


enter image description here

enter image description here

Hey, excuse me if this question is ridiculous but I can't handle with start in nodeJS, I try to install npm install -g n global and try install express locally but I cannot do this, I am trying install express like that npm install express before set my local path


原文:https://stackoverflow.com/questions/42632759
更新时间:2020-03-26 14:58

最满意答案

看起来您正在使用适用于Windows的Cmder cmd提示符。 如果您使用的是Windows,则n节点版本控制不支持它。 这是他们的文档,指定: https//github.com/tj/n

如果您安装了NPM,那么您已经安装了Node.js. 您可以输入以下命令来检查: node -v

如果在输入后没有看到类似v7.0.0的版本#,请转到此页面下载Node.js: https//nodejs.org/en/download/

此外,您还需要在cmd提示符下运行npm init来设置package.json文件 。 尝试运行用于安装express的相同命令,然后检查安装它的目录,你应该看到一个package.json文件。 查看该包文件,您将看到Express列为依赖项:)

以下是一些可以安装软件包的方法。 转到package.json文件所在的项目目录的基础,然后尝试:

  • npm i -S package name (保存到您的核心依赖项)
  • npm i -D package name (保存到您的dev依赖项)
  • npm i -g package name (全局保存)

核心依赖项适用于要在生产中使用的包,而dev依赖项适用于测试套件和构建工具等。 如果要从命令提示符中的任何目录访问程序包的CLI,则全局保存是很好的。

希望有所帮助:)


It looks like you are using the Cmder cmd prompt which is for Windows. If you are on Windows, then the n node version control does not support it. Here is their documentation that specifies that: https://github.com/tj/n

If you have NPM installed chances are you already have Node.js installed as well. You can check by typing: node -v.

If you do not see a version # like v7.0.0 after typing that, go to this page to download Node.js: https://nodejs.org/en/download/

Also, you will want to set up a package.json file by running npm init in your cmd prompt. Try running the same command you used to install express and then check the directory you installed it into, and you should see a package.json file. Look in that package file and you will see Express listed as a dependency :)

Here are a few ways you can install packages. Go to the base of your project directory where your package.json file is located and try:

  • npm i -S package name (saves to your core dependencies)
  • npm i -D package name (saves to your dev dependencies)
  • npm i -g package name (saves globally)

Core dependencies are for packages that you want to use in production whereas dev dependencies are good for things like testing suites and build tools. Saving globally is good when you want access the package's CLI from any directory in your command prompt.

Hope that helps :)

2017-03-06

相关文章

更多

最新问答

更多
  • css在元素之前中断列而不破坏包装器(css break column before element without breaking the wrapper)
  • 如何在Xamarin共享项目中使用自定义渲染器(How to use Custom Renderer in Xamarin Shared Project)
  • 如何为特定表中的特定字段设置唯一?(How to set unique for specific field from specific table?)
  • Google SDK iOS - sign()方法完成处理程序(Google SDK iOS - sign() method completion handler)
  • 在具有接口{}值的地图上实现String()(Implement String() on a map with interface{} values)
  • 检查数据库中是否已存在用户名(Check if username already exist in DB)
  • 使用javascript进行ajax调用时阻止用户交互(Block user interaction while doing ajax call using javascript)
  • 什么'if(err)'在Javascript中精确测试?(What does 'if (err)' tests precisely in Javascript?)
  • jQuery mouseleave无法正常工作(jQuery mouseleave not working)
  • 寻求使用的一些说明(Seeking some clarification on use of )
  • 将数组传递给注释的语法(syntax for passing array to annotation)
  • 用于从两个日期范围之间的文件中提取数据的Shell脚本(Shell script to extract data from file between two date ranges)
  • 元素隐藏但父()没有(Element hides but parent() not)
  • 如何使用Google App Engine Java平台开发web ui(How to develop web ui with Google App Engine Java platform)
  • 对于OWL A级;(For an OWL class A; Getting all properties that A is their domain)
  • Excel VBA公式格式问题(Excel VBA Formula Format Issue)
  • ORA - 02287序列号不允许在这里(ORA - 02287 sequence number not allowed here)
  • Github拉忽略特定文件(Github Pull Ignore Specific File)
  • SQL CONVERT函数在SQL Server中工作但不在应用程序中(SQL CONVERT function working in SQL Server but not in application)
  • backbone.js适用于大型应用程序(backbone.js for large applications)
  • 防止程序关闭(Preventing program from closing)
  • 生成不带图像的heightMap(Generating a heightMap without an Image)
  • Bootstrap - 如何将包含文本的div居中?(Bootstrap - How to center div that has text inside it?)
  • Android - 片段findViewById()总是null?(Android - Fragment findViewById() always null?)
  • 确定CSS中的高度(Figuring out heights in CSS)
  • 使用__autoload包含类和使用命名空间(Use __autoload to include class and use namespace)
  • setTimeout()不允许我传递文本值[重复](setTimeout() doesn't allow me to pass text values [duplicate])
  • 在NSUserDefault中恢复值(Restoring value in NSUserDefault)
  • 知道如何将这种下沉的悬停效果添加到图像/链接吗?(Any idea how to add this sinking hover effect to an image/link?)
  • 在XIB中淡入/淡出UISegmentedControl(fade in/fade out UISegmentedControl in XIB)