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

npm install failed to generate deps.js #1189

Open
anhminhtran235 opened this issue Mar 26, 2023 · 10 comments
Open

npm install failed to generate deps.js #1189

anhminhtran235 opened this issue Mar 26, 2023 · 10 comments

Comments

@anhminhtran235
Copy link

I followed the setup steps here and ran the following commands:

git clone https://github.com/google/closure-library
cd closure-library
npm install

At the time of this writing, this is the latest commit

After npm install is run, however, deps.js is not generated.

When I use code from the latest release, it works fine

Could somebody fix either the code or the docs (and say that the latest release must be used?)

Thank you!

@12wrigja
Copy link
Collaborator

I can't reproduce this:

tmp/closure/closure-library$ npm install
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN deprecated samsam@1.1.2: This package has been deprecated in favour of @sinonjs/samsam
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated mkdirp@0.3.0: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade

> google-closure-library@20230206.0.0 prepare
> npm run gen_deps_js

# This 'prepare' script is generating deps.js on install.
> google-closure-library@20230206.0.0 gen_deps_js
> node scripts/generate_deps_js > ./closure/goog/deps.js


added 106 packages, and audited 108 packages in 19s

22 packages are looking for funding
  run `npm fund` for details

11 vulnerabilities (1 moderate, 4 high, 6 critical)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
jameswr:tmp/closure/closure-library$

@anhminhtran235
Copy link
Author

@12wrigja Could you check if deps.js was created? I got the same terminal output as you did but deps.js was not generated

@12wrigja
Copy link
Collaborator

closure/goog/deps.js does exist and contains what look like relevant dependency management lines.

Can you try running npm run gen_deps_js and seeing if closure/goog/deps.js will be generated for you? It does for me.

@anhminhtran235
Copy link
Author

@12wrigja Oh my bad. Looks like deps.js was generated. My VS Code just didn't see it until I gave it the full path closure/goog/deps.js

I still have one issue though. I followed the Closure tutorial but got an error:

image

It's supposed to display "Hello World" on the screen. When I used the latest release of closure library, it worked (but not if I pull code from the latest commit on master)

Here is my code in case you want to take a look at it. I basically just copied from the tutorial: https://github.com/anhminhtran235/google-closure-playground

@12wrigja
Copy link
Collaborator

Looking at that repo I don't think the link to the closure-library repo is setup properly - it's not a proper submodule link.

Why do you want to link against our repository directly? We offer no stability guarantees this way, and you are far better off consuming our NPM packages.

@anhminhtran235
Copy link
Author

I pushed my code to git just to show you the folder structure as well as the hello.html and hello.js files. For some reason when the code is pushed to github, it links to the closure-library like that. Here's what it looks like on my local computer

image

@12wrigja
Copy link
Collaborator

I see.

I think what you want to do instead is something like this:

Create a new NPM project:

npm init -y

Install the Closure Library NPM package (https://www.npmjs.com/package/google-closure-library):

npm install --save google-closure-library

Then, change your hello.html file to point to base.js and deps.js from within the node module package:

<script src="closure-library/closure/goog/base.js"></script> <-- old

becomes

<script src="./node_modules/google-closure-library/closure/goog/base.js"></script>

@anhminhtran235
Copy link
Author

anhminhtran235 commented Mar 27, 2023

That makes sense. That would use the release version so I think it'd work. Do you know who's maintaining this doc? It'd be super helpful if somebody can change the instruction from cloning this repo to installing from npm. It took me quite a while to figure out that the latest release would work for me. Thank you for your help!

@12wrigja
Copy link
Collaborator

I think I've found out where that doc is being maintained internally, so I'll see if I get that updated.

@anhminhtran235
Copy link
Author

Perfect! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants