【问题标题】:What should be NPM command for solving this question?解决这个问题的 NPM 命令应该是什么?
【发布时间】:2021-04-09 12:59:11
【问题描述】:

我为这个问题尝试了各种解决方案,但无法通过 4 个测试用例中的 2 个。请帮我解决这个问题

通过在 maxbot 目录中创建名为 npm_commandspackage.json 文件来执行以下提到的步骤

  1. 创建一个名为 index.js 的文件。
  2. index.js 文件中编写一个 js 代码来创建一个名为 myVar 的字符串,并将值作为 node 包管理器 并将其转换为大写。

注意:请使用 console.log 在 index.js 文件中显示 myVar 的输出

  1. package.json 中配置 脚本 (a) 使用npm run release | tee output1.txt 检查 npm 和 node 的版本 (b) 使用npm run build | tee output.txt 执行 index.js

【问题讨论】:

  • 您是否要求社区为您做功课?这看起来不像是一个简单明了的问题

标签: npm command package.json


【解决方案1】:
  1. npm init - 初始化新包
  • 将 npm_commands 作为包名
  • 将 index.js 作为起始文件
  1. 创建名为 index.js 的新文件
  • 声明:让 myVar = "节点包管理器"
  • 以大写形式打印 var:console.log(myVar.toUpperCase());
  1. 在 package.json 中添加这些脚本
  • 检查 npm 和节点版本:“release”:“npm -v && node -v”,
  • 执行 index.js 文件:“build”:“node index.js”
  1. 保存并运行这些命令以获得结果:
  • npm 运行发布 | tee output1.txt
  • npm 运行构建 |三通输出.txt

【讨论】:

    猜你喜欢
    • 2019-08-02
    • 2015-06-13
    • 2021-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多