Windows - Error: /scripts/main.js Not Found #485

murilobr opened this Issue Sep 17, 2012 · 8 comments


None yet

6 participants


Anyone knows why this error occurs, when type yeoman build?

Writing to manifest.appcache...
Error: /scripts/main.js Not Found
    at Object.exports.error (C:\Users\usilvmu\AppData\Roaming\npm\node_modules\y
    at Object.errorHandler [as handle] (C:\Users\usilvmu\AppData\Roaming\npm\nod
    at next (C:\Users\usilvmu\AppData\Roaming\npm\node_modules\yeoman\node_modul
    at exports.send (C:\Users\usilvmu\AppData\Roaming\npm\node_modules\yeoman\no
    at Object.oncomplete (fs.js:297:15)
Error: Script error

  http://localhost:3501/scripts/vendor/9903151d.require.js:539 in onError

Could be that in index.html we have:

<!-- build:js scripts/amd-app.js -->
<script data-main="scripts/main" src="scripts/vendor/require.js"></script>
<!-- endbuild -->

And require.js doesn't find scripts/main because now the main.js was renamed to (in my case) 20beb7ef.main.js ?

But why this thing occurs just on WINDOWS?


I found a fast solution renaming some "dist/" files:

rename "dist/20beb7ef.main.js" -> "dist/main.js"
rename "dist/" -> "dist/app.js"


@murilobr when you run yeoman build the <script data-main="scripts/main" src="scripts/vendor/require.js"></script> line should get replaced with something like <script src="scripts/d1ec6433.amd-app.js"></script> in your dist/index.html file. Is that not happening?


@latentflip No. On windows its not happening.

@murilobr murilobr closed this Sep 18, 2012
@murilobr murilobr reopened this Sep 18, 2012

The file scripts/d1ec6433.amd-app.js is generated, but nothing changes into dist/index.html


This is maybe not just a windows issue, but also not certain this is the same issue you are seeing or a new issue.

I tracked it down to a problem in this section of the auto-generated Gruntfile.js:

    // rjs configuration. You don't necessarily need to specify the typical
    // `path` configuration, the rjs task will parse these values from your
    // main module, using
    // name / out / mainConfig file should be used. You can let it blank if
    // you're using usemin-handler to parse rjs config from markup (default
    // setup)
    rjs: {
      // no minification, is done by the min task
      optimize: 'none',
      baseUrl: './scripts',
      wrap: true,
      name: 'main'

By default, my project was built using app/scripts/app.js instead of app/scripts/main.js. Changing either the file name or the name config option in the grunt file fixed it for me.

Here's what my CLI looked like when build failed from brand new project build:

Grants-MacBook-Air:Test grant$ yeoman build
Running "build" task

Running usemin target
  - intro clean coffee compass mkdirs usemin-handler rjs concat css min img rev usemin manifest copy time

Running "intro" task

Running "clean" task

Running "coffee:compile" (coffee) task
Unable to compile; no valid source files were found.

Running "compass:dist" (compass) task
directory temp/styles/ 
   create temp/styles/main.css 

Running "mkdirs:staging" (mkdirs) task
Copying into /Users/grant/Projects/Test/temp
Ignoring .gitignore, .ignore, .buildignore
>> /Users/grant/Projects/Test/app -> /Users/grant/Projects/Test/temp

Running "usemin-handler:html" (usemin-handler) task
Going through index.html to update the config
looking for build script HTML comment blocks

Found a block:
    <script data-main="scripts/main" src="scripts/vendor/require.js"></script>
Updating config with the following assets:
    - scripts/vendor/require.js
    - scripts/amd-app.js

Configuration is now:

  { 'styles/main.css': [ 'styles/**/*.css' ] }

  { dist: '',
   [ 'scripts/vendor/require.js',
     'scripts/amd-app.js' ] }

  { dist: '',
  'scripts/amd-app.js': 'scripts/amd-app.js' }

  { optimize: 'none',
  baseUrl: './scripts',
  wrap: true,
  name: 'main',
  out: 'scripts/amd-app.js' }

Running "rjs" task

{ optimize: 'none',
  baseUrl: './scripts',
  wrap: true,
  name: 'main',
  out: 'scripts/amd-app.js',
  mainConfigFile: 'scripts/main.js' }
<WARN> Unable to read "scripts/main.js" file (Error code: ENOENT). Use --force to continue. </WARN>

Aborted due to warnings.
b-long commented Oct 1, 2012

+1 changing my Gruntfile.js to reference 'app' at line 172 seemed to get me further. Although, after getting past this, I have a new issue (Windows 7, Yeoman installed via Chocolatey), when I run yeoman build, I get the following output:

Running "img:dist" (img) task
Running optipng... images/glyphicons-halflings-white.png, images/glyphicons-halflings.png
CreateProcessW: The system cannot find the path specified.
<WARN> optipng exited unexpectedly with exit code 127. Use --force to continue. </WARN>

Aborted due to warnings.
kevva commented Oct 1, 2012

Yes, it's because the img task looks for optipng and jpegtran in a vendor folder inside the yeoman folder. Check my comment.

I have made a pull request (#519) with a fix but it hasn't get merged in yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment