sindresorhus/awesome-npm 源码下载与部署教程

项目概述

Awesome npm resources and tips

项目地址

https://github.com/sindresorhus/awesome-npm

项目页面预览

sindresorhus/awesome-npm preview

关键指标

  • Stars:4657
  • 主要语言:
  • License:Creative Commons Zero v1.0 Universal
  • 最近更新:2025-11-12T18:12:48Z
  • 默认分支:main

本站高速下载(国内可用)

当前未生成本站压缩包(稍后重试)。

安装部署要点(README 精选)

Don’t add to package.json when installing

By default npm adds packages you install to the dependencies field in package.json (since v5). You can prevent this by specifying the --no-save flag. You can add a package to devDependencies with --save-dev/-D:

$ npm install --save-dev ava

Run scripts

You can easily run scripts using npm by adding them to the "scripts" field in package.json and run them with npm run <script-name>. Run npm run to see available scripts. Binaries of locally install packages are made available in the PATH, so you can run them by name.

{
    "name": "awesome-package",
    "scripts": {
        "cat": "cat-names"
    },
    "dependencies": {
        "cat-names": "^1.0.0"
    }
}
$ npm run cat
Max

All package.json properties are exposed as environment variables:

{
    "name": "awesome-package",
    "scripts": {
        "name": "echo $npm_package_name"
    }
}
$ npm run name
awesome-package

Run script with npx

npm comes bundled with npx (Since v5.2.0) — a tool to execute package binaries. Each command is executed either from the local node_modules/.bin directory, or from a central cache, installing any packages needed in order for <command> to run.

{
    "name": "awesome-package",
    "dependencies": {
        "cat-names": "^1.0.0"
    }
}

If the binary is already installed, it will be executed from node_modules/.bin.

$ npx cat-names
Max

But if the binary is missing, it will be installed first.

$ npx dog-names
npx: installed 46 in 3.136s
Bentley

Run commands with different Node.js versions

With npx (Comes bundled with npm v5.2.0 or newer) and the node-bin package, you can easily try out code in different Node.js versions without having to use a version manager like nvm, nave, or n.

$ npx --package=node-bin@6.11.0 -- node --version
v6.11.0

常用命令(从 README 提取)

$ npm install --global npm

alias ni='npm install'
alias nid='npm install --save-dev'
alias nig='npm install --global'
alias nt='npm test'
alias nit='npm install && npm test'
alias nk='npm link'
alias nr='npm run'
alias ns='npm start'
alias nf='npm cache clean && rm -rf node_modules && npm install'
alias nlg='npm list --global --depth=0'

$ npm install --save-dev ava

通用部署说明

  1. 下载源码并阅读 README
  2. 安装依赖(pip/npm/yarn 等)
  3. 配置环境变量(API Key、模型路径、数据库等)
  4. 启动服务并测试访问
  5. 上线建议:Nginx 反代 + HTTPS + 进程守护(systemd / pm2)

免责声明与版权说明

本文仅做开源项目整理与教程索引,源码版权归原作者所有,请遵循对应 License 合规使用。

© 版权声明
THE END
喜欢就支持一下吧
点赞9 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容