freeCodeCamp/curriculum/challenges/chinese/05-apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-...

1.4 KiB
Raw Blame History

id title localeTitle challengeType
587d7fb5367417b2b2512c04 Remove a Package from Your Dependencies 从您的依赖项中删除一个包 2

Description

0现在您已经通过使用package.json的dependencies-section测试了一些可以管理项目依赖关系的方法。您已将外部包添加到文件中甚至通过使用特殊字符作为代字号或插入符号^告诉npm您需要哪些类型的版本。 0但是如果你想删除不再需要的外部包呢?您可能已经猜到了 - 只需从依赖项中删除相应的“key”value对。 0同样的方法也适用于删除package.json中的其他字段0说明0从依赖项中删除包时刻。 0删除后确保您有相同数量的逗号。

Instructions

Tests

tests:
  - text: '“依赖”不应该包括“时刻”'
    testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/package.json'').then(data => { var packJson = JSON.parse(data); assert.notProperty(packJson.dependencies, ''moment'', ''"dependencies" still includes "moment"''); }, xhr => { throw new Error(xhr.responseText); })'

Challenge Seed

Solution

// solution required