Closed myphysicslab closed 3 years ago
(reposting from the right account... sorry!)
Can you provide more information about how you used to consume Closure Library? It looks like you might have provided the library twice to the compiler, potentially once within ~/Documents/Programming/closure-library and once elsewhere?
../closure-library/node_modules/google-closure-library/ is also confusing as that to me implies that somehow you ran npm install google-closure-library while within the closure-library folder and somehow NPM allows that (it errors when I try it).
Hello, I did not understand what you are talking about. I am working on the command line. Can you explain it more?
في الثلاثاء، ٢٦ يناير، ٢٠٢١ ٢:٠٦ ص Erik Neumann notifications@github.com كتب:
I followed the instructions given in issue #1109 https://github.com/google/closure-library/issues/1109 and was able to make the deps.js file for closure-library. I tested that it works when running uncompiled code. However, I just tried to compile some code and got 89 errors, all pretty much the same.
[14:46:40 ~/Documents/Programming/myphysicslab]$ make doublespring Current settings: COMPILE_LEVEL = simple BUILD_DIR = build LOCALE = en UTIL_DEBUG = false GOOG_DEBUG = false ./compile_js.sh src/sims/springs/DoubleSpringApp.js build/sims/springs/DoubleSpringApp-en.js false false simple erikn's .bashrc is running --output_wrapper=/Copyright_2020_Erik_Neumann_All_Rights_Reserved_www.myphysicslab.com/%output% ++ date '+%F %T'
- java -jar ../compiler-latest/closure-compiler-v20210106.jar --entry_point=goog:myphysicslab.sims.springs.DoubleSpringApp --compilation_level=SIMPLE --define=goog.DEBUG=false '--define=goog.LOCALE='\''en'\''' '--define=module$exports$myphysicslab$lab$util$Util.ADVANCED=false' '--define=module$exports$myphysicslab$lab$util$Util.DEBUG=false' '--define=module$exports$myphysicslab$lab$util$Util.COMPILE_TIME=2021-01-25 14:46:45' --generate_exports --js=../closure-library/ --js=src --jscomp_error=accessControls --jscomp_error=checkTypes --jscomp_error=checkVars --jscomp_error=const --jscomp_error=constantProperty --jscomp_error=globalThis --jscomp_error=invalidCasts --jscomp_error=misplacedTypeAnnotation --jscomp_error=missingProperties --jscomp_error=missingProvide --jscomp_error=missingRequire --jscomp_error=missingReturn --jscomp_error=strictModuleDepCheck --jscomp_error=suspiciousCode --jscomp_error=typeInvalidation --jscomp_error=undefinedNames --jscomp_error=undefinedVars --jscomp_error=unknownDefines --jscomp_error=uselessCode --jscomp_error=visibility --hide_warnings_for=../closure-library/ --conformance_configs=/Users/erikn/Documents/Programming/myphysicslab/conformance_config.textproto --emit_use_strict --language_in=ECMASCRIPT_2017 --language_out=ECMASCRIPT_2017 --dependency_mode=PRUNE --warning_level=VERBOSE '--output_wrapper=/Copyright_2020_Erik_Neumann_All_Rights_Reserved_www.myphysicslab.com/%output%' ../closure-library/node_modules/google-closure-library/closure/goog/array/array.js:12:0: ERROR - [JSC_DUPLICATE_MODULE] Duplicate module: goog.array. Module already declared in other file ../closure-library/closure/goog/array/array.js 12| goog.module('goog.array'); ^^^^^^^^^^^^^^^^^^^^^^^^^
../closure-library/node_modules/google-closure-library/closure/goog/asserts/asserts.js:39:0: ERROR - [JSC_DUPLICATE_NAMESPACE] Duplicate namespace: goog.asserts. Namespace already provided in other file ../closure-library/closure/goog/asserts/asserts.js 39| goog.provide('goog.asserts'); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../closure-library/node_modules/google-closure-library/closure/goog/asserts/asserts.js:40:0: ERROR - [JSC_DUPLICATE_NAMESPACE] Duplicate namespace: goog.asserts.AssertionError. Namespace already provided in other file ../closure-library/closure/goog/asserts/asserts.js 40| goog.provide('goog.asserts.AssertionError'); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[... more errors ...]
../closure-library/node_modules/google-closure-library/closure/goog/style/style.js:15:0: ERROR - [JSC_DUPLICATE_NAMESPACE] Duplicate namespace: goog.style. Namespace already provided in other file ../closure-library/closure/goog/style/style.js 15| goog.provide('goog.style'); ^^^^^^^^^^^^^^^^^^^^^^^^^^
../closure-library/node_modules/google-closure-library/closure/goog/useragent/useragent.js:15:0: ERROR - [JSC_DUPLICATE_NAMESPACE] Duplicate namespace: goog.userAgent. Namespace already provided in other file ../closure-library/closure/goog/useragent/useragent.js 15| goog.provide('goog.userAgent'); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89 error(s), 0 warning(s)
- result=89
- set +x make: [build/sims/springs/DoubleSpringApp-en.js] Error 1 make: Deleting file `build/sims/springs/DoubleSpringApp-en.js'
This is my first time using node or npm. Am I not understanding something about how to use npm?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/closure-library/issues/1111, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR7VVY7DIXQAPPZTTYDLT3DS3X2NZANCNFSM4WSQBLRQ .
When I change the build command to refer to --js=../closure-library-prob/closure/goog/
instead of --js=../closure-library/
it works. When using --js=../closure-library/
it was finding the two versions that are inside of closure-library
:
closure-library/node_modules/google-closure-library/
closure-library/closure/goog/
Does this seem like the right solution? Is there supposed to be that 2nd version of closure-library inside of node_modules?
There isn't, and as far as I can tell the only way this would happen is if you had run npm install google-closure-library
(specifically that - npm install
is a different though similar command and is the right thing to install).
What is closure-library-prob
? I don't see a reference to that anywhere else in this issue...
If you want to depend on Closure Library via the NPM module, I think the high-level steps to do so are:
npm install --save google-closure-library
./node_modules/google-closure-library
) instead of referencing ~/Documents/closure-library
(which I'd guess is a checked out version of the Closure Library git repository and isn't needed anymore if you are relying on the NPM release).Thanks for your response. (The closure-library-prob
was the version of closure-library that I had run npm install
on... I was renaming versions of closure-library to figure out what was going on).
The idea of using NPM to get ("depend on") Closure Library is interesting, thanks for the tips on how to get started. I'll read up on NPM. It looks like I would still have access to the calcdeps.py
, so I could create my own deps.js
file and be able to run from uncompiled code when necessary for debugging.
FYI running npm install
does create that second version of closure-library at closure-library/node_modules/google-closure-library/
. Here is a session where I just downloaded a fresh copy of closure-library with git and then ran npm install
.
[16:08:00 ~/Documents/Programming]$ git clone https://github.com/google/closure-library.git
Cloning into 'closure-library'...
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 175687 (delta 7), reused 21 (delta 6), pack-reused 175642
Receiving objects: 100% (175687/175687), 177.90 MiB | 20.17 MiB/s, done.
Resolving deltas: 100% (151671/151671), done.
[16:08:49 ~/Documents/Programming]$ ls closure-library/
AUTHORS browser_capabilities.js protractor_spec.js
CONTRIBUTING closure sauce_browsers.json
LICENSE closure-deps scripts
README.md doc third_party
all_tests.html package.json
alltests.js protractor.conf.js
[16:08:59 ~/Documents/Programming]$ cd closure-library
[16:09:13 ~/Documents/Programming/closure-library]$ npm install
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
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 request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
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@20210106.0.0 prepare
> npm run gen_deps_js
> google-closure-library@20210106.0.0 gen_deps_js
> node scripts/gen_deps_js > ./closure/goog/deps.js
added 285 packages, and audited 288 packages in 22s
25 packages are looking for funding
run `npm fund` for details
10 vulnerabilities (5 low, 2 high, 3 critical)
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
[16:09:40 ~/Documents/Programming/closure-library]$ ls
AUTHORS browser_capabilities.js package.json
CONTRIBUTING closure protractor.conf.js
LICENSE closure-deps protractor_spec.js
README.md doc sauce_browsers.json
all_tests.html node_modules scripts
alltests.js package-lock.json third_party
[16:09:44 ~/Documents/Programming/closure-library]$ ls node_modules/
@types jsbn
adm-zip json-schema
agent-base json-schema-traverse
ajv json-stringify-safe
ansi-regex jsprim
ansi-styles jszip
argparse lcid
array-filter lie
array-union locate-path
array-uniq lodash
arrify lolex
asap lru-cache
asn1 map-age-cleaner
assert-plus mem
async mime
asynckit mime-db
available-typed-arrays mime-types
aws-sign2 mimic-fn
aws4 minimatch
balanced-match minimist
basic-auth mkdirp
bcrypt-pbkdf mocha
blocking-proxy ms
brace-expansion nice-try
browserstack npm-run-path
call-bind number-is-nan
camelcase oauth-sign
caseless object-assign
chalk object-inspect
cliui object-keys
code-point-at object.assign
color-convert once
color-name opener
colors os-locale
combined-stream os-tmpdir
commander p-defer
concat-map p-finally
core-util-is p-is-promise
corser p-limit
cross-spawn p-locate
dashdash p-try
debug pako
decamelize parse5
define-properties path-exists
del path-is-absolute
delayed-stream path-is-inside
diff path-key
ecc-jsbn performance-now
ecstatic pify
emoji-regex pinkie
end-of-stream pinkie-promise
es-abstract portfinder
es-to-primitive process-nextick-args
es6-promise promise
es6-promisify promises-aplus-tests
escape-string-regexp protractor
eventemitter3 psl
execa pump
exit punycode
extend q
extsprintf qs
fast-deep-equal readable-stream
fast-json-stable-stringify request
find-up require-directory
follow-redirects require-main-filename
foreach requires-port
forever-agent rimraf
form-data safe-buffer
formatio safer-buffer
fs.realpath samsam
function-bind saucelabs
generate_closure_unit_tests sax
get-caller-file secure-compare
get-intrinsic selenium-webdriver
get-stream semver
getpass set-blocking
glob set-immediate-shim
globby shebang-command
google-closure-deps shebang-regex
google-closure-library sigmund
growl signal-exit
har-schema sinon
har-validator source-map
has source-map-support
has-ansi sprintf-js
has-symbols sshpk
he string-width
http-proxy string.prototype.trimend
http-server string.prototype.trimstart
http-signature string_decoder
https-proxy-agent strip-ansi
immediate strip-eof
inflight supports-color
inherits tmp
ini to-iso-string
invert-kv tough-cookie
is-arguments tunnel-agent
is-callable tweetnacl
is-date-object underscore
is-fullwidth-code-point union
is-generator-function uri-js
is-negative-zero url-join
is-path-cwd util
is-path-in-cwd util-deprecate
is-path-inside uuid
is-regex verror
is-stream webdriver-js-extender
is-symbol webdriver-manager
is-typed-array which
is-typedarray which-module
isarray which-typed-array
isexe wrap-ansi
isstream wrappy
jade xml2js
jasmine xmlbuilder
jasmine-core y18n
jasmine-diff yargs
jasminewd2 yargs-parser
[16:09:51 ~/Documents/Programming/closure-library]$ ls node_modules/google-closure-library/
AUTHORS LICENSE closure third_party
CONTRIBUTING README.md package.json
[16:10:21 ~/Documents/Programming/closure-library]$ ls node_modules/google-closure-library/closure
bin goog
[16:13:18 ~/Documents/Programming/closure-library]$ ls node_modules/google-closure-library/closure/bin
build calcdeps.py labs logos
What version of NPM are you using? (npm --version
)
We do list google-closure-library
as a dev dependency for closure-deps here which is likely where that is coming from, though why this happens for you and not me is a mystery. Not entirely sure why we have it as a dev dependency anyways - I'll ask around and see if that is still needed / potentially problematic.
One last thing - the docs for npm install
mention that an environment variable NODE_ENV
can be used to change the behaviour of the install command - mine is unset, what is yours set to? echo $NODE_ENV
.
@kjin For visibility - I think there's something confusing going on here.
[23:48:03 ~/Documents/Programming/closure-library]$ npm -v
7.4.0
[23:48:08 ~/Documents/Programming/closure-library]$ node -v
v15.6.0
[23:48:11 ~/Documents/Programming/closure-library]$ nvm -v
0.37.2
[23:51:53 ~/Documents/Programming/closure-library]$ echo $NODE_ENV
[23:51:59 ~/Documents/Programming/closure-library]$ echo $NVM_DIR
/Users/erikn/.nvm
I'm using bash on Mac OS 10.15.7 Catalina. The only thing that NVM did to my .bashrc
was to define that NVM_DIR
variable.
Hey - sorry for missing the ping! There is definitely something going on here -- it's probably true that Closure library is errneously installing itself as a dependency because of the new closure-deps dependency. This should be straightforward to fix by removing the devDependency in closure-deps on google-closure-library. I will try to get a fix in within the next day (I am bandwidth-limited at the moment).
Thanks @myphysicslab for bringing this to our attention, these are exactly the kinds of issues we need to iron out after the deps.js change.
I followed the instructions given in issue #1109 and was able to make the deps.js file for closure-library. I tested that it works when running uncompiled code. However, I just tried to compile some code and got 89 errors, all pretty much the same.
This is my first time using node or npm. Am I not understanding something about how to use npm?