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

Error when bundling resources from outside node_modules #567

Closed
avrahamcool opened this issue Mar 28, 2017 · 1 comment · Fixed by #576
Closed

Error when bundling resources from outside node_modules #567

avrahamcool opened this issue Mar 28, 2017 · 1 comment · Fixed by #576
Labels

Comments

@avrahamcool
Copy link
Contributor

avrahamcool commented Mar 28, 2017

I'm submitting a bug report

  • Library Version:
    0.27.0

  • Operating System:
    Windows 10

  • Node Version:
    v6.9.5

  • NPM Version:
    3.10.9

  • Browser:
    all

  • Language:
    ESNext

Current behavior:

  1. when I'm trying to bundle npm libraries from outside node_modules folder I get an error from aurelia-templating-resources.
  2. when I'm trying to bundle libraries that don't come from npm - I get a bundling error.

step to reproduce
To showcast the problem, I created a new project and installed jquery via npm.
I added it to the bundle like this:

{
   "name": "jquery",
   "path": "../node_modules/jquery/dist",
   "main": "jquery.min"
}

and everything worked fine

Starting 'readProjectConfiguration'...
Finished 'readProjectConfiguration'
Starting 'processMarkup'...
Starting 'processCSS'...
Starting 'copyFiles'...
Starting 'configureEnvironment'...
Finished 'copyFiles'
Finished 'processCSS'
Finished 'processMarkup'
Finished 'configureEnvironment'
Starting 'buildJavaScript'...
Finished 'buildJavaScript'
Starting 'writeBundles'...
Tracing app...
Tracing environment...
Tracing main...
Tracing resources/index...
Tracing app...
Tracing aurelia-binding...
Tracing aurelia-bootstrapper...
Tracing aurelia-dependency-injection...
Tracing aurelia-event-aggregator...
Tracing aurelia-framework...
Tracing aurelia-history...
Tracing aurelia-history-browser...
Tracing aurelia-loader-default...
Tracing aurelia-logging-console...
Tracing aurelia-pal-browser...
Tracing aurelia-route-recognizer...
Tracing aurelia-router...
Tracing aurelia-templating-binding...
Tracing text...
Tracing jquery...
Tracing aurelia-templating-resources...
Tracing aurelia-templating-router...
Tracing aurelia-testing...
Writing app-bundle.js...
Writing vendor-bundle.js...
Finished 'writeBundles'

then I took the jquery directory out of node_mdules and put it into a directory called external_modules (this directory is a brother to the node_modules directory ).

I changed my bundle config accordingly to:

{
   "name": "jquery",
   "path": "../external_modules/jquery/dist",
   "main": "jquery.min"
}

and I get this error when building:

Starting 'readProjectConfiguration'...
Finished 'readProjectConfiguration'
Starting 'processMarkup'...
Starting 'processCSS'...
Starting 'copyFiles'...
Starting 'configureEnvironment'...
Finished 'copyFiles'
Finished 'processCSS'
Finished 'processMarkup'
Finished 'configureEnvironment'
Starting 'buildJavaScript'...
Finished 'buildJavaScript'
Starting 'writeBundles'...
Tracing app...
Tracing environment...
Tracing main...
Tracing resources/index...
Tracing app...
Tracing aurelia-binding...
Tracing aurelia-bootstrapper...
Tracing aurelia-dependency-injection...
Tracing aurelia-event-aggregator...
Tracing aurelia-framework...
Tracing aurelia-history...
Tracing aurelia-history-browser...
Tracing aurelia-loader-default...
Tracing aurelia-logging-console...
Tracing aurelia-pal-browser...
Tracing aurelia-route-recognizer...
Tracing aurelia-router...
Tracing aurelia-templating-binding...
Tracing text...
Tracing jquery...
Tracing aurelia-templating-resources...
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/compose.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/if.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/with.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/repeat.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/repeat-strategy-locator.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/null-repeat-strategy.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/array-repeat-strategy.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/repeat-utilities.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/map-repeat-strategy.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/set-repeat-strategy.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/number-repeat-strategy.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/analyze-view-factory.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/abstract-repeater.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/show.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/aurelia-hide-style.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/hide.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/sanitize-html.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/html-sanitizer.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/replaceable.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/focus.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/css-resource.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/attr-binding-behavior.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/binding-mode-behaviors.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/throttle-binding-behavior.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/debounce-binding-behavior.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/self-binding-behavior.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/signal-binding-behavior.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/binding-signaler.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/update-trigger-binding-behavior.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/html-resource-plugin.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
File not found or not accessible: C:/Users/USERNAME/Desktop/cli-bundle-error-show-case/node_modules/aurelia-templating-resources/dist/amd/dynamic-element.js. Requested by C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-templating-resources\dist\amd\aurelia-templating-resources.js
{ uid: 9,
  name: 'writeBundles',
  branch: false,
  error:
   TypeError: Path must be a string. Received undefined
       at assertPath (path.js:7:11)
       at Object.normalize (path.js:1177:5)
       at includes.filter.map.inclusion (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundle.js:95:45)
       at Array.map (native)
       at getDependencyLocations (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundle.js:94:8)
       at bundles.reduce (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundler.js:204:53)
       at Array.reduce (native)
       at getAllDependencyLocations (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundler.js:204:25)
       at getInclusion (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundled-source.js:157:44)
       at amodroTrace.then.traceResult (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundled-source.js:147:19),
  duration: [ 3, 151598278 ],
  time: 1490708961370 }
{ uid: 0,
  name: '<series>',
  branch: true,
  error:
   TypeError: Path must be a string. Received undefined
       at assertPath (path.js:7:11)
       at Object.normalize (path.js:1177:5)
       at includes.filter.map.inclusion (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundle.js:95:45)
       at Array.map (native)
       at getDependencyLocations (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundle.js:94:8)
       at bundles.reduce (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundler.js:204:53)
       at Array.reduce (native)
       at getAllDependencyLocations (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundler.js:204:25)
       at getInclusion (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundled-source.js:157:44)
       at amodroTrace.then.traceResult (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundled-source.js:147:19),
  duration: [ 3, 594809742 ],
  time: 1490708961370 }
TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.normalize (path.js:1177:5)
    at includes.filter.map.inclusion (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundle.js:95:45)
    at Array.map (native)
    at getDependencyLocations (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundle.js:94:8)
    at bundles.reduce (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundler.js:204:53)
    at Array.reduce (native)
    at getAllDependencyLocations (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundler.js:204:25)
    at getInclusion (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundled-source.js:157:44)
    at amodroTrace.then.traceResult (C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\aurelia-cli\lib\build\bundled-source.js:147:19)

also, if I try to bundle a library that dont come from npm (a private library called keylines that I can't show here because of legal reasons).
the library is amd compatible, and even if i put the library code inside the node_modules folder - the bundler complaines about package.json file missing.

{
   "name": "keylines",
   "path": "../node_modules/keylines/js",
   "main": "keylines"
},
Starting 'readProjectConfiguration'...
{ uid: 1,
  name: 'readProjectConfiguration',
  branch: false,
  error:
   { Error: ENOENT: no such file or directory, open 'C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\keylines\package.json'
       at Error (native)
     errno: -4058,
     code: 'ENOENT',
     syscall: 'open',
     path: 'C:\\Users\\USERNAME\\Desktop\\cli-bundle-error-show-case\\node_modules\\keylines\\package.json' },
  duration: [ 0, 57820956 ],
  time: 1490709458797 }
{ uid: 0,
  name: '<series>',
  branch: true,
  error:
   { Error: ENOENT: no such file or directory, open 'C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\keylines\package.json'
       at Error (native)
     errno: -4058,
     code: 'ENOENT',
     syscall: 'open',
     path: 'C:\\Users\\USERNAME\\Desktop\\cli-bundle-error-show-case\\node_modules\\keylines\\package.json' },
  duration: [ 0, 63698917 ],
  time: 1490709458813 }
{ Error: ENOENT: no such file or directory, open 'C:\Users\USERNAME\Desktop\cli-bundle-error-show-case\node_modules\keylines\package.json'
    at Error (native)
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\Users\\USERNAME\\Desktop\\cli-bundle-error-show-case\\node_modules\\keylines\\package.json' }
@khuongduybui
Copy link
Contributor

both bugs confirmed

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