当我运行
时,我已经在我的应用程序中安装了nodemon。 npm run prod
我收到以下错误
module.js:550
throw err;
^
Error: Cannot find module 'C:\Users\jelly\lavalite-new\cross-env'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
[nodemon] app crashed - waiting for file changes before starting...
Terminate batch job (Y/N)?
这是包json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "nodemon cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.1.3",
"cross-env": "^5.2.0",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.4",
"popper.js": "^1.12",
"pug": "^2.0.3",
"pug-loader": "^2.4.0",
"vue": "^2.5.7"
},
"dependencies": {
"laravel-echo": "^1.4.0",
"nodemon": "^1.18.4",
"pusher-js": "^4.2.2",
"urijs": "^1.19.1",
"vue-content-loader": "^0.2.1",
"vue-content-loading": "^1.5.3",
"vue-filter": "^0.2.5",
"vue-paginate": "^3.6.0",
"vue2-autocomplete-js": "^0.2.2",
"vuejs-auto-complete": "^0.7.0",
"vuex": "^3.0.1",
"vuex-i18n": "^1.10.5"
}
}
我在做什么错?
答案 0 :(得分:1)
您的脚本nodemon cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
错误。
您将传递到nodemon文件cross-env
。它is a command不是文件。您应将服务器文件(您希望启动的文件)传递给nodemon
。
正确的脚本应如下所示:
cross-env NODE_ENV=production nodemon node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js