bower / bower

A package manager for the web
bower.io
MIT License
14.99k stars 1.85k forks source link

bower error Unexpected token { Stack trace: SyntaxError: Unexpected token #2583

Closed wugengen closed 3 years ago

wugengen commented 3 years ago

Output of bower -v && npm -v && node -v: [root@centos000 bin]# ./bower install --allow-root

(paste your output here)

[?] May bower anonymously report usage statistics to improve the tool over time? Yes bower error Unexpected token { Stack trace: SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object. (/usr/local/apache-ambari-2.7.5-src/ambari-admin/src/main/resources/ui/admin- web/node_modules/bower/node_modules/bower-registry-client/node_modules/request/lib/cookies.js:3:13) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10)

Console trace: Trace at StandardRenderer.error (/usr/local/apache-ambari-2.7.5-src/ambari-admin/src/main/resources/ui/ad min-web/node_modules/bower/lib/renderers/StandardRenderer.js:72:17) at Logger. (/usr/local/apache-ambari-2.7.5-src/ambari-admin/src/main/resources/ui/admin- web/node_modules/bower/bin/bower:111:22) at emitOne (events.js:77:13) at Logger.emit (events.js:169:7) at Logger.emit (/usr/local/apache-ambari-2.7.5-src/ambari-admin/src/main/resources/ui/admin-web/nod e_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)

**Additional environment details (proxy, private registry, etc.): package.json { "name": "bower", "version": "1.3.8", "description": "The browser package manager", "author": { "name": "Twitter" }, "licenses": [ { "type": "MIT", "url": "https://github.com/bower/bower/blob/master/LICENSE" } ], "repository": { "type": "git", "url": "git://github.com/bower/bower" }, "main": "lib", "homepage": "http://bower.io", "engines": { "node": ">=0.10.0" }, "dependencies": { "abbrev": "~1.0.4", "archy": "~0.0.2", "bower-config": "~0.5.2", "bower-endpoint-parser": "~0.2.2", "bower-json": "~0.4.0", "bower-logger": "~0.2.2", "bower-registry-client": "~0.2.0", "cardinal": "~0.4.0", "chalk": "~0.4.0", "chmodr": "~0.1.0", "decompress-zip": "~0.0.6", "fstream": "~0.1.22", "fstream-ignore": "~0.0.6", "glob": "~4.0.2", "graceful-fs": "~3.0.1", "handlebars": "~1.3.0", "inquirer": "~0.5.1", "insight": "~0.3.0", "is-root": "~0.1.0", "junk": "~0.3.0", "lockfile": "~0.4.2", "lru-cache": "~2.5.0", "mkdirp": "~0.5.0", "mout": "~0.9.1", "nopt": "~3.0.0", "opn": "~0.1.1", "osenv": "~0.1.0", "p-throttler": "~0.0.1", "promptly": "~0.2.0", "q": "~1.0.1", "request": "~2.36.0", "request-progress": "~0.3.0", "retry": "~0.6.0", "rimraf": "~2.2.0", "semver": "~2.3.0", "shell-quote": "~1.4.1", "stringify-object": "~0.2.0", "tar": "~0.1.17", "tmp": "0.0.23", "update-notifier": "~0.2.0", "which": "~1.0.5" }, "devDependencies": { "expect.js": "~0.3.1", "grunt": "~0.4.4", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-watch": "~0.6.1", "grunt-exec": "~0.4.2", "grunt-simple-mocha": "~0.4.0", "istanbul": "~0.2.4", "load-grunt-tasks": "~0.4.0", "mocha": "~1.20.1", "nock": "~0.34.1", "proxyquire": "~1.0.1", "coveralls": "~2.10.0", "node-uuid": "~1.4.1" }, "scripts": { "test": "grunt test" }, "bin": { "bower": "bin/bower" }, "preferGlobal": true, "bugs": { "url": "https://github.com/bower/bower/issues" }, "_id": "bower@1.3.8", "dist": { "shasum": "afa3338a8a88a6e084c38112ea4a15998cbee3e6", "size": 116967, "noattachment": false, "tarball": "https://registry.npm.taobao.org/bower/download/bower-1.3.8.tgz" }, "_from": "bower@1.3.8", "_npmVersion": "1.4.6", "_npmUser": { "name": "paulirish", "email": "paul.irish@gmail.com" }, "maintainers": [ { "name": "sheerun", "email": "sheerun@sher.pl" } ], "directories": {}, "publish_time": 1405111794511, "_cnpm_publish_time": 1405111794511, "_hasShrinkwrap": false, "deprecated": "This Bower version has SECURITY BUG THAT ALLOWS TO WRITE TO ARBITRARY FILE ON YOUR COMPUTER when you install malicious package. Please upgrade Bower to at least version 1.8.8 if you don't want to get hacked. More info: https://snyk.io/blog/severe-security-vulnerability-in-bowers-zip-archive-extraction/", "_shasum": "afa3338a8a88a6e084c38112ea4a15998cbee3e6", "_resolved": "https://registry.npm.taobao.org/bower/download/bower-1.3.8.tgz" }

Steps to reproduce the issue:

1.when I was install ambari ,it tells me I have a problem about node_modules/bower , 2.so I just alone to run ./bower install --allow-root 3.end,I get the same problem when I was install ambari

Describe the results you received: I'm confuse,I'm a virgin

Describe the results you expected: I hope someone can help solve this problem

Additional information: There is apart of error when I install ambari

[DEBUG] Toolchains are ignored, 'executable' parameter is set to /usr/local/apache-ambari-2.7.5-src/ambari-admin/src/main/resoces/ui/admin-web/node/node [DEBUG] Executing command line: /usr/local/apache-ambari-2.7.5-src/ambari-admin/src/main/resources/ui/admin-web/node/node /usrocal/apache-ambari-2.7.5-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/bin/bower install --allow-root [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Ambari Admin View 2.7.5.0.0 ........................ FAILURE [ 7.638 s] [INFO] ambari-utility 1.0.0.0-SNAPSHOT .................... SKIPPED [INFO] ambari-metrics ..................................... SKIPPED [INFO] Ambari Metrics Common .............................. SKIPPED [INFO] Ambari Metrics Hadoop Sink ......................... SKIPPED [INFO] Ambari Metrics Flume Sink .......................... SKIPPED [INFO] Ambari Metrics Kafka Sink .......................... SKIPPED [INFO] Ambari Metrics Storm Sink .......................... SKIPPED [INFO] Ambari Metrics Storm Sink (Legacy) ................. SKIPPED [INFO] Ambari Metrics Collector ........................... SKIPPED [INFO] Ambari Metrics Monitor ............................. SKIPPED [INFO] Ambari Metrics Grafana ............................. SKIPPED [INFO] Ambari Metrics Host Aggregator ..................... SKIPPED [INFO] Ambari Metrics Assembly ............................ SKIPPED [INFO] Ambari Service Advisor 1.0.0.0-SNAPSHOT ............ SKIPPED [INFO] Ambari Server ...................................... SKIPPED [INFO] Ambari Functional Tests ............................ SKIPPED [INFO] Ambari Agent ....................................... SKIPPED [INFO] ambari-logsearch ................................... SKIPPED [INFO] Ambari Logsearch Appender .......................... SKIPPED [INFO] Ambari Logsearch Config Api ........................ SKIPPED [INFO] Ambari Logsearch Config JSON ....................... SKIPPED [INFO] Ambari Logsearch Config Solr ....................... SKIPPED [INFO] Ambari Logsearch Config Zookeeper .................. SKIPPED [INFO] Ambari Logsearch Config Local ...................... SKIPPED [INFO] Ambari Logsearch Log Feeder Plugin Api ............. SKIPPED [INFO] Ambari Logsearch Log Feeder Container Registry ..... SKIPPED [INFO] Ambari Logsearch Log Feeder ........................ SKIPPED [INFO] Ambari Logsearch Web ............................... SKIPPED [INFO] Ambari Logsearch Server ............................ SKIPPED [INFO] Ambari Logsearch Assembly .......................... SKIPPED [INFO] Ambari Logsearch Integration Test .................. SKIPPED [INFO] ambari-infra ....................................... SKIPPED [INFO] Ambari Infra Solr Client ........................... SKIPPED [INFO] Ambari Infra Solr Plugin ........................... SKIPPED [INFO] Ambari Infra Manager ............................... SKIPPED [INFO] Ambari Infra Assembly .............................. SKIPPED [INFO] Ambari Infra Manager Integration Tests 2.7.5.0.0 ... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 8.596 s [INFO] Finished at: 2020-07-01T22:14:21-04:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (Bower install) on project ambari-admin: Commandxecution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec ower install) on project ambari-admin: Command execution failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: Command execution failed.

18640169740 commented 3 years ago

I have the same problem. Have you solved it?

sheerun commented 3 years ago

The message "May bower anonymously report usage statistics to improve the tool over time? Yes" indicates that you are using very old version of bower, we don't collect statistics for a long time now. Please make sure Bower is upgraded to the latest version (as of now 1.8.8)