2016-06-13 146 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