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

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

Closed
murilobr opened this issue Sep 17, 2012 · 8 comments · Fixed by #660
Closed

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

murilobr opened this issue Sep 17, 2012 · 8 comments · Fixed by #660
Labels

Comments

@murilobr
Copy link

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
eoman\node_modules\connect\lib\utils.js:43:13)
    at Object.errorHandler [as handle] (C:\Users\usilvmu\AppData\Roaming\npm\nod
e_modules\yeoman\tasks\server.js:368:31)
    at next (C:\Users\usilvmu\AppData\Roaming\npm\node_modules\yeoman\node_modul
es\connect\lib\proto.js:190:15)
    at exports.send (C:\Users\usilvmu\AppData\Roaming\npm\node_modules\yeoman\no
de_modules\connect\lib\middleware\static.js:158:11)
    at Object.oncomplete (fs.js:297:15)
Error: Script error
http://requirejs.org/docs/errors.html#scripterror

  http://localhost:3501/scripts/vendor/9903151d.require.js:1818
  http://localhost:3501/scripts/vendor/9903151d.require.js:539 in onError
  http://localhost:3501/scripts/vendor/9903151d.require.js:1713
CACHE MANIFEST
@murilobr
Copy link
Author

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?

@murilobr
Copy link
Author

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

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

@latentflip
Copy link
Contributor

@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?

@murilobr
Copy link
Author

@latentflip No. On windows its not happening.

@murilobr murilobr reopened this Sep 18, 2012
@murilobr
Copy link
Author

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

@granteagon
Copy link
Contributor

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 http://requirejs.org/docs/optimization.html#mainConfigFile
    //
    // 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:

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

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

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

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

Running "rjs" task

Options:
{ 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
Copy link

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
Copy link
Member

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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants