2016-06-13 153 views
1

我想我能做的故宫,而不是亭子,我所做的就是做npm install angular --save,然后包括像这样使用NPM模块失败

<script src="../node_modules/angular/angular.js"></script>

但似乎路径不正确。我创建一个临时回购来展示我的文件夹结构。

https://github.com/eldyvoon/temp/

+0

我没有看到'repo中的'node_modules'文件夹。请确保您已成功设置'NPM'。 – Vineet

+0

@Vineet试图克隆并运行'npm install'。通常人们会在.gitignore中放入node_modules文件夹。 –

回答

1

为了使用node_modules你不得不暴露与browsersync的direcotry。

试试这个,改变这样的gulfile.js浏览器同步一饮而尽任务:

gulp.task('browser-sync', function() { 
    browserSync.init(null, { 
     server: { 
      baseDir: 'app', 
      routes: { 
       '/node_modules': './node_modules' 
      } 
     } 
    }); 
}); 

在您的index.html你的jQuery的进口是错误的,这样做:

<script src="../node_modules/jquery/dist/jquery.min.js"></script> 

希望这有帮助,让我知道如果你需要更多的信息

+0

你确定这是问题吗?即使我手动刷新我仍然有错误angularjs文件未加载 –

+0

我试过你的项目。你有没有重新启动浏览器同步?如果你可以在jour github项目 – rick

+0

上创建一个请求,我在你的项目 – rick