yeoman / generator-chrome-extension

Scaffold out a Chrome extension
http://yeoman.io
MIT License
2.62k stars 224 forks source link

Can't successfully build the extension #207

Closed xzycn closed 2 years ago

xzycn commented 5 years ago

Hi, I have met a problem when I build a extension using gulp build in root path. The output as follows:

λ gulp build                                                                                                                                           
[14:56:39] Failed to load external module @babel/register                                                                                              
[14:56:39] Requiring external module babel-register                                                                                                    
[14:56:53] Using gulpfile F:\project\Node\AmazonPicker\gulpfile.babel.js                                                                               
[14:56:53] Starting 'build'...                                                                                                                         
[14:56:53] Starting 'lint'...                                                                                                                          
[14:56:57] Finished 'lint' after 3.42 s                                                                                                                
[14:56:57] Starting 'babel'...                                                                                                                         
[14:56:57] Finished 'babel' after 470 ms                                                                                                               
[14:56:57] Starting 'chromeManifest'...                                                                                                                

events.js:167                                                                                                                                          
      throw er; // Unhandled 'error' event                                                                                                             
      ^                                                                                                                                                
Error                                                                                                                                                  
    at new JS_Parse_Error (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:1534:18)          
    at js_error (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:1542:11)                    
    at parse_error (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:1667:9)                  
    at read_num (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:1693:13)                    
    at Object.next_token [as input] (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:1933:40)
    at next (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2075:25)                        
    at vardefs (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2509:48)                     
    at const_ (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2530:27)                      
    at eval (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2268:30)                        
    at eval (eval at <anonymous> (F:\project\Node\AmazonPicker\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2136:24)                        
Emitted 'error' event at:                                                                                                                              
    at Duplexify.onerror (F:\project\Node\AmazonPicker\node_modules\duplexify\node_modules\readable-stream\lib\_stream_readable.js:640:52)             
    at Duplexify.emit (events.js:182:13)                                                                                                               
    at Duplexify._destroy (F:\project\Node\AmazonPicker\node_modules\duplexify\index.js:191:15)                                                        
    at F:\project\Node\AmazonPicker\node_modules\duplexify\index.js:182:10                                                                             

So,what's the problem with this?Thanks in advance :)

RobertJGabriel commented 5 years ago

Could you link or post to your mainfest file that is created :)

xzycn commented 5 years ago

@RobertJGabriel Hi, here is my manifest.json:

{
  "manifest_version": 2,
  "name": "Sample",
  "description": "Sample",
  "version": "0.1",
  "browser_action":{
    "default_icon":{
      "19":"images/icon128.png"
    },
    "default_popup":"popup.html",
    "default_title":"Sample"
  },
  "icons": {
    "128": "images/icon128.png",
    "16": "images/icon16.png",
    "48": "images/icon48.png"
  },
  "permissions": [
    "contextMenus",
    "notifications"
  ],
  "background": {
    "scripts": [
      "js/axios.min.js",
      "js/pouchdb.min.js",
      "js/constants.js",
      "js/common.js",
      "js/db.js",
      "js/api.js",
      "js/background.js"
    ]
  },
  "content_scripts":[
    {
      "css": [
        "css/alertify.css"
      ],
      "js": [
        "js/jq.js",
        "js/alertify.js",
        "js/content.js"
      ],
      "matches": [
        "*://*/*"
      ],
      "run_at": "document_end"
    }
  ],
  "content_security_policy":"script-src 'self' 'unsafe-eval'; object-src 'self'"

}
jculverwell commented 5 years ago

I am also getting the same issue. Did anyone find a resolution.

jculverwell commented 5 years ago

Ignore my last message, I had an old version, updated to the latest and everything works as expected.

HaoweiCh commented 5 years ago

use nvm to change node to 8..