我想知道如何让角度4.x文档脱机。
我从github克隆了angular repo。
我将yarn
运行到aio
目录中(如README中所述)。
然而它给了我以下错误
yarn install v0.27.5
[1/4] Resolving packages...
success Already up-to-date.
$ uglifyjs node_modules/lunr/lunr.js -c -m -o src/assets/js/lunr.min.js --source-map
fs.js:652
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
TypeError: path must be a string or Buffer
at Object.fs.openSync (fs.js:652:18)
at Object.fs.writeFileSync (fs.js:1299:33)
at /Users/apple/code/angular/aio/node_modules/directory-encoder/node_modules/uglify-js/bin/uglifyjs:311:12
at /Users/apple/code/angular/aio/node_modules/directory-encoder/node_modules/async/lib/async.js:188:33
at /Users/apple/code/angular/aio/node_modules/directory-encoder/node_modules/uglify-js/bin/uglifyjs:254:9
at tryToString (fs.js:513:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:501:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
然后我跑了yarn docs
,它给了我以下输出:
yarn docs v0.27.5
$ rimraf src/generated/{docs,*.json}
$ dgeni ./tools/transforms/angular.io-package
info: running processor: readFilesProcessor
info: running processor: extractJSDocCommentsProcessor
info: running processor: collectExamples
info: running processor: readTypeScriptModules
info: running processor: linkInheritedDocs
info: running processor: parseTagsProcessor
info: running processor: extractTagsProcessor
info: running processor: codeNameProcessor
info: running processor: createOverviewDump
info: running processor: convertPrivateClassesToInterfacesProcessor
info: running processor: mergeDecoratorDocs
info: running processor: extractDecoratedClassesProcessor
info: running processor: markBarredODocsAsPrivate
info: running processor: computeIdsProcessor
info: running processor: filterContainedDocs
info: running processor: filterPrivateDocs
info: running processor: simplifyMemberAnchors
info: running processor: computePathsProcessor
info: running processor: generateApiListDoc
info: running processor: addNotYetDocumentedProperty
info: running processor: matchUpDirectiveDecorators
info: running processor: processNavigationMap
info: running processor: renderDocsProcessor
info: running processor: unescapeCommentsProcessor
info: running processor: inlineTagProcessor
info: running processor: renderExamples
info: running processor: copyContentAssetsProcessor
info: running processor: postProcessHtml
info: running processor: computeSearchTitleProcessor
info: running processor: generateKeywordsProcessor
info: running processor: checkUnbalancedBackTicks
info: running processor: fixInternalDocumentLinks
info: running processor: checkAnchorLinksProcessor
warn: Dangling Links Found in "guide/aot-compiler.json":
- generated/zips/toh-pt6/toh-pt6.zip
warn: Dangling Links Found in "guide/quickstart.json":
- generated/zips/cli-quickstart/cli-quickstart.zip
warn: Dangling Links Found in "guide/webpack.json":
- generated/zips/webpack/webpack.zip
warn: Dangling Links Found in "docs.json":
- generated/live-examples/quickstart/eplnkr.html
error: Error: 4 unmatched links
at Object.$process (/Users/apple/code/angular/aio/node_modules/dgeni-packages/base/processors/checkAnchorLinks.js:106:17)
at /Users/apple/code/angular/aio/node_modules/dgeni/lib/Dgeni.js:179:54
at _fulfilled (/Users/apple/code/angular/aio/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/apple/code/angular/aio/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/apple/code/angular/aio/node_modules/q/q.js:796:13)
at /Users/apple/code/angular/aio/node_modules/q/q.js:604:44
at runSingle (/Users/apple/code/angular/aio/node_modules/q/q.js:137:13)
at flush (/Users/apple/code/angular/aio/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
error: Error processing docs: Error: 4 unmatched links
at Object.$process (/Users/apple/code/angular/aio/node_modules/dgeni-packages/base/processors/checkAnchorLinks.js:106:17)
at /Users/apple/code/angular/aio/node_modules/dgeni/lib/Dgeni.js:179:54
at _fulfilled (/Users/apple/code/angular/aio/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/apple/code/angular/aio/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/apple/code/angular/aio/node_modules/q/q.js:796:13)
at /Users/apple/code/angular/aio/node_modules/q/q.js:604:44
at runSingle (/Users/apple/code/angular/aio/node_modules/q/q.js:137:13)
at flush (/Users/apple/code/angular/aio/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
/Users/apple/code/angular/aio/node_modules/q/q.js:155
throw e;
^
Error: 4 unmatched links
at Object.$process (/Users/apple/code/angular/aio/node_modules/dgeni-packages/base/processors/checkAnchorLinks.js:106:17)
at /Users/apple/code/angular/aio/node_modules/dgeni/lib/Dgeni.js:179:54
at _fulfilled (/Users/apple/code/angular/aio/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/apple/code/angular/aio/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/apple/code/angular/aio/node_modules/q/q.js:796:13)
at /Users/apple/code/angular/aio/node_modules/q/q.js:604:44
at runSingle (/Users/apple/code/angular/aio/node_modules/q/q.js:137:13)
at flush (/Users/apple/code/angular/aio/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
error Command failed with exit code 1.
有人知道解决方法吗?我只想获得离线阅读的文档。
修改: 按照@ gavlan的回应并将纱线降级到v0.24.6,这是我的输出:
yarn install v0.24.6
[1/4] Resolving packages...
success Already up-to-date.
$ uglifyjs node_modules/lunr/lunr.js -c -m -o src/assets/js/lunr.min.js --source-map
✨ Done in 2.75s.
因此,运行yarn
不会出错,并且执行正常。
然而,运行`yarn docs仍然会出错
yarn docs v0.24.6
$ rimraf src/generated/{docs,*.json}
$ dgeni ./tools/transforms/angular.io-package
info: running processor: readFilesProcessor
info: running processor: extractJSDocCommentsProcessor
info: running processor: collectExamples
info: running processor: readTypeScriptModules
info: running processor: linkInheritedDocs
info: running processor: parseTagsProcessor
info: running processor: extractTagsProcessor
info: running processor: codeNameProcessor
info: running processor: createOverviewDump
info: running processor: convertPrivateClassesToInterfacesProcessor
info: running processor: mergeDecoratorDocs
info: running processor: extractDecoratedClassesProcessor
info: running processor: markBarredODocsAsPrivate
info: running processor: computeIdsProcessor
info: running processor: filterContainedDocs
info: running processor: filterPrivateDocs
info: running processor: simplifyMemberAnchors
info: running processor: computePathsProcessor
info: running processor: generateApiListDoc
info: running processor: addNotYetDocumentedProperty
info: running processor: matchUpDirectiveDecorators
info: running processor: processNavigationMap
info: running processor: renderDocsProcessor
info: running processor: unescapeCommentsProcessor
info: running processor: inlineTagProcessor
info: running processor: renderExamples
info: running processor: copyContentAssetsProcessor
info: running processor: postProcessHtml
info: running processor: computeSearchTitleProcessor
info: running processor: generateKeywordsProcessor
info: running processor: checkUnbalancedBackTicks
info: running processor: fixInternalDocumentLinks
info: running processor: checkAnchorLinksProcessor
warn: Dangling Links Found in "guide/aot-compiler.json":
- generated/zips/toh-pt6/toh-pt6.zip
warn: Dangling Links Found in "guide/quickstart.json":
- generated/zips/cli-quickstart/cli-quickstart.zip
warn: Dangling Links Found in "guide/webpack.json":
- generated/zips/webpack/webpack.zip
warn: Dangling Links Found in "docs.json":
- generated/live-examples/quickstart/eplnkr.html
error: Error: 4 unmatched links
at Object.$process (/Users/apple/code/angular/aio/node_modules/dgeni-packages/base/processors/checkAnchorLinks.js:106:17)
at /Users/apple/code/angular/aio/node_modules/dgeni/lib/Dgeni.js:179:54
at _fulfilled (/Users/apple/code/angular/aio/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/apple/code/angular/aio/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/apple/code/angular/aio/node_modules/q/q.js:796:13)
at /Users/apple/code/angular/aio/node_modules/q/q.js:604:44
at runSingle (/Users/apple/code/angular/aio/node_modules/q/q.js:137:13)
at flush (/Users/apple/code/angular/aio/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
error: Error processing docs: Error: 4 unmatched links
at Object.$process (/Users/apple/code/angular/aio/node_modules/dgeni-packages/base/processors/checkAnchorLinks.js:106:17)
at /Users/apple/code/angular/aio/node_modules/dgeni/lib/Dgeni.js:179:54
at _fulfilled (/Users/apple/code/angular/aio/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/apple/code/angular/aio/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/apple/code/angular/aio/node_modules/q/q.js:796:13)
at /Users/apple/code/angular/aio/node_modules/q/q.js:604:44
at runSingle (/Users/apple/code/angular/aio/node_modules/q/q.js:137:13)
at flush (/Users/apple/code/angular/aio/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
/Users/apple/code/angular/aio/node_modules/q/q.js:155
throw e;
^
Error: 4 unmatched links
at Object.$process (/Users/apple/code/angular/aio/node_modules/dgeni-packages/base/processors/checkAnchorLinks.js:106:17)
at /Users/apple/code/angular/aio/node_modules/dgeni/lib/Dgeni.js:179:54
at _fulfilled (/Users/apple/code/angular/aio/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/apple/code/angular/aio/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/apple/code/angular/aio/node_modules/q/q.js:796:13)
at /Users/apple/code/angular/aio/node_modules/q/q.js:604:44
at runSingle (/Users/apple/code/angular/aio/node_modules/q/q.js:137:13)
at flush (/Users/apple/code/angular/aio/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
error Command failed with exit code 1.
答案 0 :(得分:1)
看起来这是由于纱线@> = 0.25.4中的错误可能会在node_mdules / .bin /中安装错误的版本。它已用yarnpkg /纱线#3877固定,应包含在0.28.1版本中。
尝试更新纱线并再次运行该命令。 有关详细信息,请查看角度项目中的official issue