为什么我的项目没有node_modules文件夹

时间:2017-06-06 07:07:19

标签: json node.js npm

是否有一个与node_modules文件夹等效的纱线?

我有一个新的MERN项目文件夹。它有一个package.json文件。 package.json文件包含babel的依赖项和dev依赖项(下面的完整列表):

"dependencies": {
    "axios": "^0.16.1",
    "babel-cli": "^6.24.1",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-polyfill": "^6.13.0",
    "body-parser": "^1.17.1",
    "caniuse-api": "^2.0.0",
    "express": "^4.13.4",
    "lodash": "^4.17.4",
    "material-ui": "^0.18.0",
    "nodemon": "^1.11.0",
    "react": "^15.5.4",
    "react-dom": "^15.5.4",
    "react-promise": "^1.1.2",
    "react-redux": "^5.0.4",
    "react-router": "^4.1.1",
    "react-tap-event-plugin": "^2.0.1",
    "redux": "^3.6.0",
    "redux-devtools": "^3.4.0",
    "redux-form": "^6.7.0",
    "redux-thunk": "^2.2.0",
    "socket.io": "^2.0.1",
    "source-map-support": "^0.4.15"
  },
  "devDependencies": {
    "babel": "^6.23.0",
    "babel-core": "^6.24.1",
    "babel-loader": "^7.0.0",
    "babelify": "^7.3.0",
    "enzyme": "^2.8.2",
    "mocha": "^3.3.0",
    "react-addons-test-utils": "^15.5.1",
    "webpack": "^2.5.1"
  }

我正在尝试使用import语句而不是require语句。我认为这应该有效,因为我有babel依赖,但是当我尝试运行npm start时,我收到一条错误消息:

/server.js:2
import bodyParser from 'body-parser';
^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)
[nodemon] app crashed - waiting for file changes before starting...

如果使用纱线,尝试使用npm start会有什么问题吗?我是否应该尝试找到一个等效的命令行启动语句,因为我使用的是纱线而不是npm?

我安装了npm。我不明白为什么我没有节点模块文件夹?

0 个答案:

没有答案