Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript systemJS错误找不到模块_Javascript_Node.js_Reactjs_Systemjs - Fatal编程技术网

Javascript systemJS错误找不到模块

Javascript systemJS错误找不到模块,javascript,node.js,reactjs,systemjs,Javascript,Node.js,Reactjs,Systemjs,我有一个安装了systemJS的小项目 下面是package.json: { "name": "mytest", "version": "0.1.0", "private": true, "dependencies": { "react": "^15.5.4", "react-dom": "^15.5.4", "systemjs": "^0.20.13" }, "devDependencies": { "react-scripts": "1

我有一个安装了systemJS的小项目

下面是package.json:

{
  "name": "mytest",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^15.5.4",
    "react-dom": "^15.5.4",
    "systemjs": "^0.20.13"
  },
  "devDependencies": {
    "react-scripts": "1.0.7"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}
在app.js中,我完成了以下操作:

import React, { Component } from 'react';
import './App.css';

var SystemJS = require('systemjs');
当我运行项目时,它会给我以下错误:

错误:找不到模块“”

我遵循这里的说明:

https://github.com/systemjs/systemjs

本部分:

var SystemJS = require('systemjs');

// loads './app.js' from the current directory
SystemJS.import('./app.js').then(function (m) {
  console.log(m);
});

我做错了什么?

您的问题可能是由于您错过了systemjs,这就是指示it在何处查找要加载的模块

例如,配置可以如下所示:

System.config({
  baseURL: './lib',

  // Set paths your modules
  paths: {
    'angular': 'mode_modules/angular/angular.js',
    'angular-route': 'node_modules/angular-route/angular-route.js'
  }
});
如果您想跳过繁琐的配置部分(您可能想看看),它会自动处理配置部分