Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[help] "npm run build" or "npm run serve" didn't work as expected #3523

Closed
brightzheng100 opened this issue Nov 9, 2023 · 9 comments
Closed
Assignees
Labels
question Further information is requested

Comments

@brightzheng100
Copy link
Contributor

brightzheng100 commented Nov 9, 2023

By following the contribution guide, after drafting the PR for Issue #3488, I was trying to build the site for the final review but the process was broken.

npm version
{
  npm: '10.1.0',
  node: '20.8.1',
...
}
npm install
npm run build

I got this:

> prebuild
> npm run _prebuild


> _prebuild
> npm run seq -- get:submodule cp:spec


> seq
> bash -c 'for cmd in "$@"; do npm run $cmd || exit 1; done' - get:submodule cp:spec


> get:submodule
> npm run _get:${GET:-submodule}


> _get:submodule
> set -x && git submodule update --init ${DEPTH:- --depth 1}

+ git submodule update --init --depth 1
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: transport 'file' not allowed
fatal: Fetched in submodule path 'content-modules/community', but it did not contain 0cb6dcadb53f1f7ffe5ef819ceef02ac9e6886c8. Direct fetching of that commit failed.

So I manually updated the submodules with:

git submodule update --recursive --init

This didn't work:

fatal: transport 'file' not allowed
fatal: Fetched in submodule path 'content-modules/community', but it did not contain 0cb6dcadb53f1f7ffe5ef819ceef02ac9e6886c8. Direct fetching of that commit failed.

So tried something else:

git submodule update --force --recursive --init --remote

And all submodules had been updated, expected 'themes/docsy':

Submodule path 'content-modules/community': checked out '8d480e00ab3e07d011f35b10fc3b76eb1a3d86ff'
Submodule path 'content-modules/opamp-spec': checked out 'b2037c3456caf173f2c1c6cd1d9500fe9c1c545d'
Submodule path 'content-modules/opentelemetry-proto': checked out 'f674adf15f7e779c6b83ef0dce240fa286b860d8'
Submodule path 'content-modules/opentelemetry-specification': checked out 'd855249b210ecd832889fc4ce91a4444f82e252a'
Submodule path 'content-modules/semantic-conventions': checked out '65a3cc743f71ee202242ca4e984c5f8bb56e187d'
fatal: Unable to find refs/remotes/origin/opentelemetry.io revision in submodule path 'themes/docsy'

Obviously, the submodule of 'themes/docsy' had issues.

And then tried again with _get:submodule ignored:

npm run serve --ignore-scripts "_get:submodule"

I got this:

> serve
> npm run serve:hugo _get:submodule


> serve:hugo
> npm run _serve:hugo _get:submodule


> _serve:hugo
> hugo server -DFE --minify _get:submodule

Watching for changes in /Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/{archetypes,assets,content-modules,content,data,iconography,layouts,package.json,static}
Watching for config changes in /Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/hugo.yaml
Start building sites …
hugo v0.120.3-a4892a07b41b7b3f1f143140ee4ec0a9a5cf3970+extended darwin/arm64 BuildDate=2023-11-01T17:57:00Z VendorInfo=gohugoio

Built in 166 ms
Error: error building site: assemble: "/Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/content/en/_index.md:14:1": failed to extract shortcode: template for shortcode "blocks/cover" not found

So is this a known issue or did I do something wrongly here?

@brightzheng100 brightzheng100 added the bug Something isn't working label Nov 9, 2023
@brightzheng100 brightzheng100 changed the title "npm run build" or "npm run serve" didn't work as expected [bug] "npm run build" or "npm run serve" didn't work as expected Nov 9, 2023
@brightzheng100
Copy link
Contributor Author

So the focus will be the submodule themes/docsy and more experiments were conducted:

$ git submodule update --init --recursive --force themes/docsy
Submodule path 'themes/docsy': checked out 'fd669b752b7f83fb2eb57cacd2c8f334f86ca7d2'

$ ls themes/docsy
CHANGELOG.md        LICENSE             dependencies        go.sum              images              package.json        theme.toml
CONTRIBUTING.md     README.md           docker-compose.yaml hugo.yaml           layouts             postcss.config.js   userguide
Dockerfile          assets              go.mod              i18n                netlify.toml        static

$ npm run serve --ignore-scripts "_get:submodule"

Then I was seeing more errors:

> serve
> npm run serve:hugo _get:submodule


> serve:hugo
> npm run _serve:hugo _get:submodule


> _serve:hugo
> hugo server -DFE --minify _get:submodule

Watching for changes in /Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/{archetypes,assets,content-modules,content,data,iconography,layouts,package.json,static,themes}
Watching for config changes in /Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/hugo.yaml, /Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/themes/docsy/hugo.yaml
Start building sites …
hugo v0.120.4-f11bca5fec2ebb3a02727fb2a5cfb08da96fd9df+extended darwin/arm64 BuildDate=2023-11-08T11:18:07Z VendorInfo=gohugoio

ERROR spec_status: Can't find page at '/docs/specs/otel/trace/api'.
ERROR spec_status shortcode error: page '/docs/specs/otel/trace/api' does not contain a line matching 'Status'.
ERROR spec_status shortcode error: 'Status' value did not match one of '(?i:experimental|stable|deprecated|removed|mixed|feature.freeze|alpha|beta)' in file '/docs/specs/otel/trace/api': matched line is ''
ERROR spec_status: Can't find page at '/docs/specs/otel/trace/sdk'.
ERROR spec_status shortcode error: page '/docs/specs/otel/trace/sdk' does not contain a line matching 'Status'.
ERROR spec_status shortcode error: 'Status' value did not match one of '(?i:experimental|stable|deprecated|removed|mixed|feature.freeze|alpha|beta)' in file '/docs/specs/otel/trace/sdk': matched line is ''
ERROR spec_status: Can't find page at '/docs/specs/otlp'.
ERROR spec_status shortcode error: page '/docs/specs/otlp' does not contain a line matching 'Status'.
ERROR spec_status shortcode error: 'Status' value did not match one of '(?i:experimental|stable|deprecated|removed|mixed|feature.freeze|alpha|beta)' in file '/docs/specs/otlp': matched line is ''
ERROR spec_status: Can't find page at '/docs/specs/otel/metrics/api'.
ERROR spec_status shortcode error: page '/docs/specs/otel/metrics/api' does not contain a line matching 'Status'.
ERROR spec_status shortcode error: 'Status' value did not match one of '(?i:experimental|stable|deprecated|removed|mixed|feature.freeze|alpha|beta)' in file '/docs/specs/otel/metrics/api': matched line is ''
ERROR spec_status: Can't find page at '/docs/specs/otel/metrics/sdk'.
ERROR spec_status shortcode error: page '/docs/specs/otel/metrics/sdk' does not contain a line matching 'Status'.
ERROR spec_status shortcode error: 'Status' value did not match one of '(?i:experimental|stable|deprecated|removed|mixed|feature.freeze|alpha|beta)' in file '/docs/specs/otel/metrics/sdk': matched line is ''
ERROR spec_status: Can't find page at '/docs/specs/otel/baggage/api'.
ERROR spec_status shortcode error: page '/docs/specs/otel/baggage/api' does not contain a line matching 'Status'.
ERROR spec_status shortcode error: 'Status' value did not match one of '(?i:experimental|stable|deprecated|removed|mixed|feature.freeze|alpha|beta)' in file '/docs/specs/otel/baggage/api': matched line is ''
ERROR spec_status: Can't find page at '/docs/specs/otel/logs/bridge-api'.
ERROR spec_status shortcode error: page '/docs/specs/otel/logs/bridge-api' does not contain a line matching 'Status'.
ERROR spec_status shortcode error: 'Status' value did not match one of '(?i:experimental|stable|deprecated|removed|mixed|feature.freeze|alpha|beta)' in file '/docs/specs/otel/logs/bridge-api': matched line is ''
ERROR spec_status: Can't find page at '/docs/specs/otel/logs/sdk'.
ERROR spec_status shortcode error: page '/docs/specs/otel/logs/sdk' does not contain a line matching 'Status'.
ERROR spec_status shortcode error: 'Status' value did not match one of '(?i:experimental|stable|deprecated|removed|mixed|feature.freeze|alpha|beta)' in file '/docs/specs/otel/logs/sdk': matched line is ''
ERROR spec_status: Can't find page at '/docs/specs/otel/logs/event-api'.
ERROR spec_status shortcode error: page '/docs/specs/otel/logs/event-api' does not contain a line matching 'Status'.
ERROR spec_status shortcode error: 'Status' value did not match one of '(?i:experimental|stable|deprecated|removed|mixed|feature.freeze|alpha|beta)' in file '/docs/specs/otel/logs/event-api': matched line is ''
ERROR render of "page" failed: "/Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/layouts/_default/baseof.html:19:7": execute of template failed: template: _default/search.html:19:7: executing "_default/search.html" at <partialCached "scripts.html" .>: error calling partialCached: "/Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/themes/docsy/layouts/partials/scripts.html:84:30": execute of template failed: template: partials/scripts.html:84:30: executing "partials/scripts.html" at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat
ERROR render of "page" failed: "/Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/themes/docsy/layouts/blog/baseof.html:33:7": execute of template failed: template: blog/single.html:33:7: executing "blog/single.html" at <partial "scripts.html" .>: error calling partial: "/Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/themes/docsy/layouts/partials/scripts.html:84:30": execute of template failed: template: partials/scripts.html:84:30: executing "partials/scripts.html" at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat
ERROR render: failed to render pages: render of "page" failed: "/Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/layouts/_default/baseof.html:19:7": execute of template failed: template: _default/single.html:19:7: executing "_default/single.html" at <partialCached "scripts.html" .>: error calling partialCached: "/Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/themes/docsy/layouts/partials/scripts.html:84:30": execute of template failed: template: partials/scripts.html:84:30: executing "partials/scripts.html" at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat
Built in 1106 ms
Error: error building site: TOCSS: failed to transform "scss/main.scss" (text/x-scss): "/Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/themes/docsy/assets/scss/main.scss:1:1": File to import not found or unreadable: ../vendor/bootstrap/scss/functions.

@chalin chalin self-assigned this Nov 9, 2023
@chalin
Copy link
Contributor

chalin commented Nov 9, 2023

Hi. I just did a clean build (on two different machines) and it works fine. Let's see if a clean build works for you too. Try the following from a new terminal:

  1. cd ~/tmp or any other temporary dir that you have access to
  2. git clone https://github.com/open-telemetry/opentelemetry.io.git
  3. cd opentelemetry.io
  4. nvm install
  5. npm install -- capture the output and share it here.

@brightzheng100
Copy link
Contributor Author

brightzheng100 commented Nov 9, 2023

Interestingly, it worked in a clean clone.

I didn't use nvm so I thought that might be needed but it still didn't work in my existing clone.

$ git remote -vv
origin	[email protected]:brightzheng100/opentelemetry.io.git (fetch)
origin	[email protected]:brightzheng100/opentelemetry.io.git (push)
upstream	https://github.com/open-telemetry/opentelemetry.io.git (fetch)
upstream	https://github.com/open-telemetry/opentelemetry.io.git (push)

$ git fetch upstream

$ git merge upstream/main
Already up to date.

$ nvm install
Found '/Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io/.nvmrc' with version <lts/*>
v20.9.0 is already installed.
Now using node v20.9.0 (npm v10.1.0)

$ npm install

> prepare
> npm run seq -- get:submodule _prepare:docsy


> seq
> bash -c 'for cmd in "$@"; do npm run $cmd || exit 1; done' - get:submodule _prepare:docsy


> get:submodule
> npm run _get:${GET:-submodule}


> _get:submodule
> set -x && git submodule update --init ${DEPTH:- --depth 1}

+ git submodule update --init --depth 1
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: transport 'file' not allowed
fatal: Fetched in submodule path 'content-modules/community', but it did not contain 0cb6dcadb53f1f7ffe5ef819ceef02ac9e6886c8. Direct fetching of that commit failed.
npm ERR! code 1
npm ERR! path /Users/brightzheng/workspaces/OSS/OpenTelemetry/opentelemetry.io
npm ERR! command failed
npm ERR! command sh -c npm run seq -- get:submodule _prepare:docsy

npm ERR! A complete log of this run can be found in: /Users/brightzheng/.npm/_logs/2023-11-09T08_48_08_191Z-debug-0.log
$ git status
On branch update-building-a-trace-receiver
Your branch is ahead of 'upstream/main' by 2 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
	modified:   content-modules/community (new commits, modified content)
	modified:   content-modules/opamp-spec (new commits, modified content)
	modified:   content-modules/opentelemetry-proto (new commits, modified content)
	modified:   content-modules/opentelemetry-specification (modified content)
	modified:   content-modules/semantic-conventions (new commits, modified content)
	modified:   content/en/docs/collector/trace-receiver.md
	modified:   themes/docsy (modified content)

no changes added to commit (use "git add" and/or "git commit -a")

@brightzheng100
Copy link
Contributor Author

I tried deinit the submodules but it didn't help:

$ git submodule deinit -f --all
Cleared directory 'content-modules/community'
Submodule 'content-modules/community' (https://github.com/open-telemetry/community) unregistered for path 'content-modules/community'
Cleared directory 'content-modules/opamp-spec'
Submodule 'content-modules/opamp-spec' (https://github.com/open-telemetry/opamp-spec) unregistered for path 'content-modules/opamp-spec'
Cleared directory 'content-modules/opentelemetry-proto'
Submodule 'content-modules/opentelemetry-proto' (https://github.com/open-telemetry/opentelemetry-proto) unregistered for path 'content-modules/opentelemetry-proto'
Cleared directory 'content-modules/opentelemetry-specification'
Submodule 'content-modules/opentelemetry-specification' (https://github.com/open-telemetry/opentelemetry-specification.git) unregistered for path 'content-modules/opentelemetry-specification'
Cleared directory 'content-modules/semantic-conventions'
Submodule 'content-modules/semantic-conventions' (https://github.com/open-telemetry/semantic-conventions) unregistered for path 'content-modules/semantic-conventions'
Cleared directory 'themes/docsy'
Submodule 'themes/docsy' (https://github.com/cncf/docsy.git) unregistered for path 'themes/docsy'

$ git status
On branch update-building-a-trace-receiver
Your branch is ahead of 'upstream/main' by 2 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   content/en/docs/collector/trace-receiver.md
$ npm run serve

> serve
> npm run serve:hugo


> preserve:hugo
> npm run _prebuild


> _prebuild
> npm run seq -- get:submodule cp:spec


> seq
> bash -c 'for cmd in "$@"; do npm run $cmd || exit 1; done' - get:submodule cp:spec


> get:submodule
> npm run _get:${GET:-submodule}


> _get:submodule
> set -x && git submodule update --init ${DEPTH:- --depth 1}

+ git submodule update --init --depth 1
Submodule 'content-modules/community' (https://github.com/open-telemetry/community) registered for path 'content-modules/community'
Submodule 'content-modules/opamp-spec' (https://github.com/open-telemetry/opamp-spec) registered for path 'content-modules/opamp-spec'
Submodule 'content-modules/opentelemetry-proto' (https://github.com/open-telemetry/opentelemetry-proto) registered for path 'content-modules/opentelemetry-proto'
Submodule 'content-modules/opentelemetry-specification' (https://github.com/open-telemetry/opentelemetry-specification.git) registered for path 'content-modules/opentelemetry-specification'
Submodule 'content-modules/semantic-conventions' (https://github.com/open-telemetry/semantic-conventions) registered for path 'content-modules/semantic-conventions'
Submodule 'themes/docsy' (https://github.com/cncf/docsy.git) registered for path 'themes/docsy'
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: transport 'file' not allowed
fatal: Fetched in submodule path 'content-modules/community', but it did not contain 0cb6dcadb53f1f7ffe5ef819ceef02ac9e6886c8. Direct fetching of that commit failed.

@brightzheng100
Copy link
Contributor Author

brightzheng100 commented Nov 9, 2023

It finally worked with the flow like this:

$ git clone [email protected]:brightzheng100/opentelemetry.io.git opentelemetry.io-mine
$ cd opentelemetry.io-mine

$ git remote add upstream https://github.com/open-telemetry/opentelemetry.io.git
$ git fetch upstream
$ git merge upstream/main

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
$ nvm install
$ npm install
$ npm run serve

@chalin
Copy link
Contributor

chalin commented Nov 9, 2023

Interestingly, it worked in a clean clone.

Thanks for confirming that a clean clone builds just fine for you too. I'll remove the "bug" label in that case, and we can continue attempting to debug your setup and/or workflow.

@chalin chalin changed the title [bug] "npm run build" or "npm run serve" didn't work as expected [help] "npm run build" or "npm run serve" didn't work as expected Nov 9, 2023
@chalin chalin added question Further information is requested and removed bug Something isn't working labels Nov 9, 2023
@chalin
Copy link
Contributor

chalin commented Nov 9, 2023

I'm a bit confused now.

It can be different issues but this is reproducible on my side so please advise what is wrong:

As is mentioned in Local setup, you need to execute npm install before attempting to build or serve the site. Otherwise the site won't build. Try that and see if it helps.

@brightzheng100
Copy link
Contributor Author

I just tried more and you're right that my flow may not be correct previously, so I updated my previous comment with the workable flow I used.

BTW, is the nvm a must?

@chalin
Copy link
Contributor

chalin commented Nov 9, 2023

I'm glad it's working now!

BTW, is the nvm a must?

No, use of nvm is optional. What is required is to use the active LTS version of Node -- see step 3 of the Local setup instructions.

@chalin chalin closed this as completed Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants