Skip to content

Only download from a private registry and remove registry.npmjs.org. #1196

@thomasnikolay

Description

@thomasnikolay

I tried to remove the download from the registry.npmjs.org website because we want to remove downloads from public repositories (Shai Hulud). The following log snippet shows that the installation is still being attempted from registry.npmjs.org.

[INFO] --- frontend:1.15.4:npx (generate-asyncapi-spring-java) @ xxx ---
[DEBUG] Loading mojo com.github.eirslett:frontend-maven-plugin:1.15.4:npx from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.15.4, parent: sun.misc.Launcher$AppClassLoader@7852e922]
[DEBUG] Configuring mojo execution 'com.github.eirslett:frontend-maven-plugin:1.15.4:npx:generate-asyncapi-spring-java' with basic configurator -->
[DEBUG] (f) arguments = --userconfig=D:\xxx/.npmrc
ag
--output D:\xxx\target/generated-sources-xxx
--param javaPackage=com.xxx
--param springBoot2=true
--debug
D:\xxx/src/main/resources/api/event/xxx.yaml
@asyncapi/[email protected]
[DEBUG] (f) environmentVariables = {NPM_CONFIG_REGISTRY=https://xxx.com/nexus/repository/npm-all/, NPM_CONFIG_USERCONFIG=D:\xxx/.npmrc}
[DEBUG] (f) installDirectory = D:\xxx\target
[DEBUG] (f) npmInheritsProxyConfigFromMaven = true
[DEBUG] (f) project = MavenProject: com.xxx:xxx:0.0.15-b01-SNAPSHOT @ D:\xxx\pom.xml
[DEBUG] (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@6daf2337
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@50825a02
[DEBUG] (f) skipTests = false
[DEBUG] (f) testFailureIgnore = false
[DEBUG] (f) workingDirectory = D:\xxx\xxx\xxx
[DEBUG] (f) execution = com.github.eirslett:frontend-maven-plugin:1.15.4:npx {execution: generate-asyncapi-spring-java}
[DEBUG] -- end configuration --
[INFO] Running 'npx --userconfig=D:\xxx\xxx\xxx/.npmrc ag --output D:\xxx\xxx\xxx\target/generated-sources-event-api-tmp --param javaPackage=com.xxxx --param springBoot2=true --debug D:\xxx\xxx\xxx/src/main/resources/api/event/xxx-event.yaml @asyncapi/[email protected]' in D:\xxx\xxx\xxx
[DEBUG] Executing command line [D:\xxx\xxx\xxx\target\node\node.exe, D:\xxx\xxx\xxx\target\node\node_modules\npm\bin\npx-cli.js, --userconfig=D:\xxx\xxx\xxx/.npmrc, ag, --output, D:\xxx\xxx\xxx\target/generated-sources-event-api-tmp, --param, javaPackage=com.xxx, --param, springBoot2=true, --debug, D:\xxx\xxx\xxx/src/main/resources/api/event/xxx-event.yaml, @asyncapi/[email protected]]
[INFO] Template is not available locally and expected location is undefined. Known details are: undefined Error: Cannot find module '@asyncapi\[email protected]\package.json'
[INFO] Require stack:
[INFO] - D:\xxx\xxx\xxx\target\node\node_modules\noop.js
[INFO] at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
[INFO] at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (D:\xxx\xxx\xxx\node_modules@cspotcode\source-map-support\source-map-support.js:811:30)
[INFO] at resolveFileName (D:\xxx\xxx\xxx\node_modules\resolve-from\index.js:29:39)
[INFO] at resolveFrom (D:\xxx\xxx\xxx\node_modules\resolve-from\index.js:43:9)
[INFO] at module.exports (D:\xxx\xxx\xxx\node_modules\resolve-from\index.js:46:47)
[INFO] at utils.getTemplateDetails (D:\xxx\xxx\xxx\node_modules@asyncapi\generator\lib\utils.js:196:30)
[INFO] at Generator.installTemplate (D:\xxx\xxx\xxx\node_modules@asyncapi\generator\lib\generator.js:561:24)
[INFO] at Generator.installAndSetupTemplate (D:\xxx\xxx\xxx\node_modules@asyncapi\generator\lib\generator.js:283:73)
[INFO] at Generator.generate (D:\xxx\xxx\xxx\node_modules@asyncapi\generator\lib\generator.js:196:16)
[INFO] at processTicksAndRejections (node:internal/process/task_queues:95:5) {
[INFO] code: 'MODULE_NOT_FOUND',
[INFO] requireStack: [
[INFO] 'D:\DEV_HOME\WC\xxx\xxx\target\node\node_modules\noop.js'
[INFO] ]
[INFO] }
[INFO] Template installation started because the template cannot be found on disk.
[INFO] Using npm registry registry.npmjs.org and authorization type anonymous to handle template installation.
[INFO] Template @asyncapi/java-spring-template successfully installed in D:\xxx\xxx\xxx\node_modules@asyncapi\generator\node_modules@asyncapi\java-spring-template.
[INFO] Version of used template is 1.6.0.`

I am using the following plugin configuration:

<plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.15.4</version>
        <configuration>
          <installDirectory>${project.build.directory}</installDirectory>
        </configuration>
        <executions>
          <execution>
            <id>install-node-and-npm</id>
            <goals>
              <goal>install-node-and-npm</goal>
            </goals>
            <phase>initialize</phase>
            <configuration>
              <environmentVariables>
                 <NPM_CONFIG_REGISTRY>https://xxx.com/nexus/repository/npm-all/</NPM_CONFIG_REGISTRY>
				 <NPM_CONFIG_USERCONFIG>${basedir}/.npmrc</NPM_CONFIG_USERCONFIG>				 
              </environmentVariables>	
              <nodeVersion>v18.20.4</nodeVersion>
              <npmVersion>10.8.3</npmVersion>
              <npmInheritsProxyConfigFromMaven>true</npmInheritsProxyConfigFromMaven>
              <nodeDownloadRoot>https://xxx.com/nexus/repository/nodejs-dist/</nodeDownloadRoot>
              <npmDownloadRoot>https://xxx.com/nexus/repository/npm-dist/-/</npmDownloadRoot>
              <verbose>true</verbose>			  
			  <workingDirectory>${project.basedir}/target/checkout</workingDirectory>
			  <installDirectory>${project.basedir}/target</installDirectory>-->
            </configuration>
          </execution>
		  <execution>
            <id>npm-clean-cache</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>initialize</phase>
            <configuration>
			  <environmentVariables>
                 <NPM_CONFIG_REGISTRY>https://xxx.com/nexus/repository/npm-all/</NPM_CONFIG_REGISTRY>
				 <NPM_CONFIG_USERCONFIG>${basedir}/.npmrc</NPM_CONFIG_USERCONFIG>				 
              </environmentVariables>	
              <arguments><![CDATA[
			  cache clean --force
              ]]></arguments>
            </configuration>
          </execution>
		  <execution>
            <id>npm-install</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>initialize</phase>
            <configuration>
			  <environmentVariables>
                 <NPM_CONFIG_REGISTRY>https://xxx.com/nexus/repository/npm-all/</NPM_CONFIG_REGISTRY>
				 <NPM_CONFIG_USERCONFIG>${basedir}/.npmrc</NPM_CONFIG_USERCONFIG>				 
              </environmentVariables>	
              <arguments><![CDATA[
			  --userconfig=${basedir}/.npmrc
              install
                --registry=https://xxx.com/nexus/repository/npm-all/
                [email protected] @asyncapi/[email protected]
              ]]></arguments>
            </configuration>
          </execution>
          <execution>
            <id>generate-asyncapi-spring-java</id>
            <goals>
              <goal>npx</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
			<environmentVariables>
                 <NPM_CONFIG_REGISTRY>https://xxx.com/nexus/repository/npm-all/</NPM_CONFIG_REGISTRY>				 			
				 <NPM_CONFIG_USERCONFIG>${basedir}/.npmrc</NPM_CONFIG_USERCONFIG>
              </environmentVariables>	
              <arguments><![CDATA[
                --userconfig=${basedir}/.npmrc
                ag
                --output ${project.build.directory}/generated-sources-xxx
                --param javaPackage=com.xxx
                --param springBoot2=true
                --debug	
                ${path.event.api.yaml}
                @asyncapi/[email protected]
              ]]></arguments>
            </configuration>
          </execution>
 
        </executions>
      </plugin>

I tried every configuration which I found in the tickets and ChatGPT.
Is it possible to reach the goal?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions