Tiêu đề này có thể gây hiểu lầm đôi chút nhưng hãy chịu đựng tôi một lúc.Không thể tìm thấy node_modules sau khi triển khai
Tôi đã tạo đơn giản Angular2
ứng dụng trên studio trực quan 2015 và giờ tôi có published it on Azure
.
Có node_modules trong môi trường phát triển hoàn hảo nhưng sau khi triển khai nó cho thấy lỗi không thể tìm thấy node_modules.
Sau đây là cách tôi đề cập trong env phát triển của tôi trong index.html -
<!-- Polyfill(s) for older browsers -->
<script src="/node_modules/core-js/client/shim.min.js"></script>
<script src="/node_modules/zone.js/dist/zone.js"></script>
<script src="/node_modules/reflect-metadata/Reflect.js"></script>
<script src="/node_modules/systemjs/dist/system.src.js"></script>
<script src="/systemjs.config.js"></script>
của nó cũng được gọi trong system.config.js -
/**
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': '/app', // 'dist',
'@angular': '/node_modules/@angular',
'angular2-in-memory-web-api': '/node_modules/angular2-in-memory-web-api',
'rxjs': '/node_modules/rxjs'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
};
var ngPackageNames = [
'common',
'compiler',
'core',
'forms',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade',
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
// No umd for router yet
packages['@angular/router'] = { main: 'index.js', defaultExtension: 'js' };
var config = {
map: map,
packages: packages
};
System.config(config);
})(this);
Lỗi có ý nghĩa vì tôi có tệp .gitignore không cho phép các node_modules triển khai đến máy chủ.
Ai đó có thể vui lòng hỗ trợ cách tôi có thể chạy sau khi triển khai và thay đổi nào có thể được thực hiện với các tham chiếu ở trên để làm cho nó hoạt động.
Cảm ơn bạn đã liên kết. Nhưng tôi không thể hiểu được làm thế nào để chạy các lệnh trong liên kết. –