{"action":"created","issue":{"url":"https://api.github.com/repos/cocos-creator/editor-framework/issues/352","repository_url":"https://api.github.com/repos/cocos-creator/editor-framework","labels_url":"https://api.github.com/repos/cocos-creator/editor-framework/issues/352/labels{/name}","comments_url":"https://api.github.com/repos/cocos-creator/editor-framework/issues/352/comments","events_url":"https://api.github.com/repos/cocos-creator/editor-framework/issues/352/events","html_url":"https://github.com/cocos-creator/editor-framework/issues/352","id":166824392,"number":352,"title":"Adding npm dependencies for package causing many errors","user":{"login":"Aerlinger","id":604138,"avatar_url":"https://avatars.githubusercontent.com/u/604138?v=3","gravatar_id":"","url":"https://api.github.com/users/Aerlinger","html_url":"https://github.com/Aerlinger","followers_url":"https://api.github.com/users/Aerlinger/followers","following_url":"https://api.github.com/users/Aerlinger/following{/other_user}","gists_url":"https://api.github.com/users/Aerlinger/gists{/gist_id}","starred_url":"https://api.github.com/users/Aerlinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aerlinger/subscriptions","organizations_url":"https://api.github.com/users/Aerlinger/orgs","repos_url":"https://api.github.com/users/Aerlinger/repos","events_url":"https://api.github.com/users/Aerlinger/events{/privacy}","received_events_url":"https://api.github.com/users/Aerlinger/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cocos-creator/editor-framework/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/cocos-creator/editor-framework/labels/in%20progress","name":"in progress","color":"fef2c0"},{"url":"https://api.github.com/repos/cocos-creator/editor-framework/labels/need%20more%20information","name":"need more information","color":"0e8a16"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2016-07-21T13:51:29Z","updated_at":"2016-08-02T12:08:08Z","closed_at":null,"body":"I have a generic package with the following directory structure:\r\n\r\n```\r\nmyPackage/\r\n  - package.json\r\n  - main.js\r\n  - panel/\r\n     - panel.js\r\n```\r\n\r\nI wanted to use font-awesome in my package and tried running `npm install --save font-awesome`. It installed fine into a `node_modules` folder and updated the package.json.\r\n\r\nHowever, after installing this module I get a long list of errors in my package:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/604138/17024994/f221e192-4f27-11e6-9cf4-1f3726ffcda0.png)\r\n\r\nYet, removing font-awesome from my `package.json` AND running `npm prune` resolves the issue entirely.\r\n\r\nThese errors occur for any npm packages I include in package.json, not just font-awesome.\r\n\r\nFor reference, here are the relevant files in my package:\r\n\r\n**package.json**\r\n```json\r\n{\r\n  \"name\": \"sample-pkg\",\r\n  \"version\": \"0.0.1\",\r\n  \"description\": \"A placeholder panel for layout design\",\r\n  \"author\": \"Firebox Technology\",\r\n  \"main\": \"main.js\",\r\n  \"main-menu\": {\r\n    \"Examples/SamplePkg\": {\r\n      \"message\": \"sample-pkg:open\"\r\n    }\r\n  },\r\n  \"panel\": {\r\n    \"main\": \"panel/panel.js\",\r\n    \"popable\": false,\r\n    \"type\": \"dockable\",\r\n    \"title\": \"Sample Package\",\r\n    \"icon\": \"panel/icon.png\",\r\n    \"height\": 300,\r\n    \"shortcuts\": {\r\n      \"command+k\": \"clear\",\r\n      \"ctrl+k\": \"clear\"\r\n    }\r\n  },\r\n  \"dependencies\": {\r\n      \"font-awesome\": \"^4.6.3\"\r\n  }\r\n}\r\n```\r\n\r\n**main.js**\r\n```javascript\r\n'use strict';\r\n\r\nconst Electron = require('electron');\r\n\r\nmodule.exports = {\r\n  load () {\r\n    Editor.log(\"Pkg loaded\")\r\n  },\r\n\r\n  unload () {\r\n    // Editor.Menu.unregister( 'open-log-file' );\r\n  },\r\n\r\n  messages: {\r\n    'open' () {\r\n      Editor.Panel.open('sample-pkg');\r\n    }\r\n  }\r\n};\r\n```\r\n\r\n\r\n**panel/panel.js**\r\n```javascript\r\n'use strict';\r\n\r\nEditor.Panel.extend({\r\n  template: `\r\n    <div id=\"console\" class=\"fit\">\r\n        <header>\r\n            <textarea id=\"editor\"></textarea>\r\n        </header>\r\n    </div>\r\n    `,\r\n\r\n  listeners: {\r\n    click ( event ) {\r\n      event.stopPropagation();\r\n      console.log('click!');\r\n    },\r\n\r\n    'panel-resize' ( event ) {\r\n      console.log(event.target);\r\n    },\r\n\r\n    open() {\r\n      Editor.Panel.open('sample-pkg')\r\n    }\r\n  },\r\n\r\n  ready () {\r\n\r\n  },\r\n\r\n  run (argv) {\r\n    console.log(`Pkg run with args: ${argv}`);\r\n  }\r\n});\r\n```\r\n\r\nNot sure if I'm missing anything, but it seems like adding an npm module without any other change to the code shouldn't cause these issues."},"comment":{"url":"https://api.github.com/repos/cocos-creator/editor-framework/issues/comments/236884728","html_url":"https://github.com/cocos-creator/editor-framework/issues/352#issuecomment-236884728","issue_url":"https://api.github.com/repos/cocos-creator/editor-framework/issues/352","id":236884728,"user":{"login":"VinciShark","id":9538504,"avatar_url":"https://avatars.githubusercontent.com/u/9538504?v=3","gravatar_id":"","url":"https://api.github.com/users/VinciShark","html_url":"https://github.com/VinciShark","followers_url":"https://api.github.com/users/VinciShark/followers","following_url":"https://api.github.com/users/VinciShark/following{/other_user}","gists_url":"https://api.github.com/users/VinciShark/gists{/gist_id}","starred_url":"https://api.github.com/users/VinciShark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VinciShark/subscriptions","organizations_url":"https://api.github.com/users/VinciShark/orgs","repos_url":"https://api.github.com/users/VinciShark/repos","events_url":"https://api.github.com/users/VinciShark/events{/privacy}","received_events_url":"https://api.github.com/users/VinciShark/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T12:08:08Z","updated_at":"2016-08-02T12:08:08Z","body":"@Aerlinger So we can just sit and wait for electron's new release?"}}
{"actor":{"display_login":"VinciShark"}}