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

TypeError: Cannot read property 'replace' of undefined #17

Open
ghost opened this issue Jun 20, 2017 · 1 comment
Open

TypeError: Cannot read property 'replace' of undefined #17

ghost opened this issue Jun 20, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 20, 2017

gulpfile.babel.js:

import gulp from 'gulp';
import useref from 'useref';
import browserSync from 'browser-sync';
import {create} from 'browser-sync';

const bs = create();


gulp.task('default',()=>{
  bs.init({
    server:{
      baseDir:'./'
    }
  })
})

gulp.task('demo',()=>{
  gulp.src('./src/css-practice/index.html')
  .pipe(useref())
  .pipe(gulp.dest('./dist'))
})

file ./src/css-practice/index.html with a sample content:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>css</title>
  </head>
  <body>
    sdasd
  </body>
</html>

cmd:

gulp demo

then get error:

TypeError: Cannot read property 'replace' of undefined
    at module.exports (/Users/xuxuewen/workspace/coding/com.andy.train/node_modules/useref/lib/getBlocks.js:31:19)
    at module.exports (/Users/xuxuewen/workspace/coding/com.andy.train/node_modules/useref/index.js:8:16)
    at Gulp.<anonymous> (/Users/xuxuewen/workspace/coding/com.andy.train/gulpfile.babel.js:28:9)
    at module.exports (/Users/xuxuewen/workspace/coding/com.andy.train/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/xuxuewen/workspace/coding/com.andy.train/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/xuxuewen/workspace/coding/com.andy.train/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/Users/xuxuewen/workspace/coding/com.andy.train/node_modules/orchestrator/index.js:134:8)
    at /Users/xuxuewen/.nvm/versions/node/v6.10.2/lib/node_modules/gulp/bin/gulp.js:129:20
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
@jonkemp
Copy link
Owner

jonkemp commented Jun 21, 2017

Use the gulp plugin rather than this module. That should fix it.

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

No branches or pull requests

1 participant