在本文中,您将会了解到关于命令'npmrundev'失败NuxtJS的新资讯,同时我们还将为您解释npmrundev出错的相关在本文中,我们将带你探索命令'npmrundev'失败NuxtJS的奥秘,
在本文中,您将会了解到关于命令'npm run dev'失败NuxtJS的新资讯,同时我们还将为您解释npm run dev出错的相关在本文中,我们将带你探索命令'npm run dev'失败NuxtJS的奥秘,分析npm run dev出错的特点,并给出一些关于cnpm run dev或npm run dev问题收集、gruntjs – 如何卸载npm包?、gruntjs – 是否有一个注射器像grunt-wireep,适用于NPM依赖?、Laravel Mix:npm run dev 和 npm run watch 错误-> configuration.loader 应该是一个对象的实用技巧。
本文目录一览:- 命令'npm run dev'失败NuxtJS(npm run dev出错)
- cnpm run dev或npm run dev问题收集
- gruntjs – 如何卸载npm包?
- gruntjs – 是否有一个注射器像grunt-wireep,适用于NPM依赖?
- Laravel Mix:npm run dev 和 npm run watch 错误-> configuration.loader 应该是一个对象
命令'npm run dev'失败NuxtJS(npm run dev出错)
如何解决命令''npm run dev''失败NuxtJS?
当我尝试运行我的开发服务器时出现以下错误。我对 Vue/Nuxt 很陌生
0 verbose cli [
0 verbose cli ''C:\\Program Files\\nodejs\\node.exe'',0 verbose cli ''C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js'',0 verbose cli ''run'',0 verbose cli ''dev''
0 verbose cli ]
1 info using npm@7.6.3
2 info using node@v15.12.0
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc
Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:D:\Projects\TCG\IGG\iggbouwkostenkompas\.npmrc
Completed in 0ms
9 timing config:load:project Completed in 0ms
10 timing config:load:file:C:\Users\ghoeksema\.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\ghoeksema\AppData\Roaming\npm\etc\npmrc
Completed in 1ms
13 timing config:load:global Completed in 1ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 7ms
19 verbose npm-session 46dffbc867d5c2db
20 timing npm:load Completed in 14ms
21 timing command:run Completed in 694ms
22 verbose stack Error: command Failed
22 verbose stack at ChildProcess.<anonymous> (C:\Program
Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
22 verbose stack at ChildProcess.emit (node:events:369:20)
22 verbose stack at maybeClose (node:internal/child_process:1067:16)
22 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
23 verbose pkgid bouwkosten-index@1.0.0
24 verbose cwd D:\Projects\TCG\IGG\iggbouwkostenkompas
25 verbose Windows_NT 10.0.19041
26 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
27 verbose node v15.12.0
28 verbose npm v7.6.3
29 error code 1
30 error path D:\Projects\TCG\IGG\iggbouwkostenkompas
31 error command Failed
32 error command C:\Windows\system32\cmd.exe /d /s /c nuxt
33 verbose exit 1
我不知道如何修复它并进行了一些搜索,但没有一个解决方案对我有用。清除缓存也没有用
提前致谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
cnpm run dev或npm run dev问题收集
#vue项目中遇到的问题
跟着 拯救地球好累丫的简书文章上的操作,遇到的问题
vue入门 | 使用vue.js2.0 + ElementUI开发后台管理系统详细教程(一)
vue入门 | 使用vue.js2.0 + ElementUI开发后台管理系统详细教程(二)
##1.解除端口占用方法
- 1.1首先点击开始菜单选择运行,接着在运行对话框中输入“cmd”,回车打开命令提示符窗口,然后在窗口中输入【netstat -ano】,按下回车,之后就会显示所有的端口占用情况。
C:\Users\Administrator>netstat -ano
活动连接
协议 本地地址 外部地址 状态 PID
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 880
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:902 0.0.0.0:0 LISTENING 4940
TCP 0.0.0.0:912 0.0.0.0:0 LISTENING 4940
TCP 0.0.0.0:1025 0.0.0.0:0 LISTENING 564
TCP 0.0.0.0:1026 0.0.0.0:0 LISTENING 968
TCP 0.0.0.0:1027 0.0.0.0:0 LISTENING 412
TCP 0.0.0.0:1028 0.0.0.0:0 LISTENING 668
TCP 0.0.0.0:1065 0.0.0.0:0 LISTENING 632
TCP [::1]:8080 [::1]:8080 ESTABLISHED 792
- 2.1如果你要查询指定的端口占用的话,可以在窗口中继续输入【netstat -aon|findstr "提示的端口"】,这里的提示的端口假设为8080,那么就输入命令为【netstat -aon|findstr "8080"】,
C:\Users\Administrator>netstat -ano|findstr "8080"
TCP [::1]:8080 [::1]:8080 ESTABLISHED 792
注意findstr后面有空格;
- 3.1然后根据查询的PID找到对应的进程,我么可以看到占有80这个程序的进程ID:792,继续输入命令【tasklist|findstr "792"】,792就是进程ID,现在知道是哪个进程占用的我们就可以采取相应措施进行解决了。
C:\Users\Administrator>tasklist|findstr "792"
QQ.exe 5856 Console 1 128,792 K
360se.exe 792 Console 1 132,752 K
##2.cnpm run dev 报错
- 2.1These dependencies were not found in node_modules
ERROR Failed to compile with 2 errors
These dependencies were not found in node_modules:
*ansi-html in ./~/.2.17.0@webpack-hot-middleware/client-overlay.js
*html-entities in ./~/.2.17.0@webpack-hot-middleware/client-overlay.js
因为package.json中"webpack-hot-middleware": "^2.16.1",和运行的版本不一致导致,修改为“^2.17.0”,也不管用,运行
cnpm uninstall webpack-hot-middleware --save-dev
再运行
cnpm install webpack-hot-middleware@2.16.1 --save-dev
- 2.2error in ./src/main.js 检查main.js空行
error in ./src/main.js
✘ http://eslint.org/docs/rules/no-multiple-empty-lines More than 1 blank line not allowed
D:\download\backup\workspace\MyApp\Vuejs\my-project\src\main.js:6:1
^
✘ 1 problem (1 error, 0 warnings)
Errors:
1 http://eslint.org/docs/rules/no-multiple-empty-lines
@ multi ./build/dev-client ./src/main.js
src\main.js代码中:
<script>
import Vue from ''vue''
import Element from ''element-ui''
import ''element-ui/lib/theme-default/index.css''
Vue.use(Element)
export default {
name: ''app'',
data: function () {
return {
active: true
}
}
}
</script>
- 2.3error in ./src/App.vue App.vue中<script>中必须含 import Vue from ''vue''
error in ./src/App.vue
✘ http://eslint.org/docs/rules/no-undef ''Vue'' is not defined
D:\download\backup\workspace\MyApp\Vuejs\my-project\src\App.vue:37:3
Vue.use(Element)
^
✘ 1 problem (1 error, 0 warnings)
Errors:
1 http://eslint.org/docs/rules/no-undef
@ ./src/main.js 3:0-24
@ multi ./build/dev-client ./src/main.js
src\main.js代码中:
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from ''vue''
import App from ''./App''
import router from ''./router''
/* eslint-disable no-new */
new Vue({
el: ''#app'',
router,
template: ''<App/>'',
components: { App }
})
- 2.4关闭eslint检查,把不需要检查的文件名加到/.eslintignore文件中
gruntjs – 如何卸载npm包?
我试试:
$ sudo npm uninstall grunt
但它给了WARN:
npm WARN uninstall not installed in /home/kuba/projects/node_modules: "grunt-cli"
我也尝试rm,删除和取消链接。和-g选项,它给出:
npm WARN uninstall not installed in /usr/lib/node_modules: "grunt"
但我仍然可以从命令行调用grunt。
编辑:
$ whereis grunt grunt: /usr/local/bin/grunt $ file /usr/local/bin/grunt /usr/local/bin/grunt: symbolic link to `../lib/node_modules/grunt/bin/grunt' $ ls /usr/local/lib/node_modules grunt jshint $ ls /usr/lib/node_modules bower csslint devtools-terminal npm plato
为什么我有2个目录与npm?只是删除它是安全的吗?
解决方法
npm uninstall< module> – 保存
请注意,运行此命令时,应该从包含node_modules文件夹的同一目录中卸载npm模块。 –save选项也会从package.json中删除它
还可以通过从本地node_modules文件夹中删除其目录来删除本地依赖项/模块安装。是的,它是安全的删除依赖项。
要卸载全局安装的npm模块,请运行:
npm uninstall -g< module>
从哪里运行此命令无关紧要。
要安装npm模块,请运行:(仅作参考)
npm install< module>
…要么:
npm install(如果你的项目的根目录有一个package.json文件)
…要么:
npm install< module> –save-dev(如果要为依赖关系添加最小版本)
关于Grunt的好消息:
>如果你在2013年2月18日(the day grunt v0.4.x
was released)之前安装了grunt stable,你可能有一个较旧的grunt版本仍然留在你的系统中。这是因为全球安装了低于0.4.x的grunt版本,这在升级/维护版本时造成了很多痛苦。
> grunt和grunt-cli是两个不同的东西。
> grunt(没有“cli”)通常通过运行npm install在项目级别安装(当在package.json中列为devDependency时)。这也称为本地安装。
> grunt-cli是本地版本的grunt在不同项目/文件夹中运行的基础。它可以在本地安装,但在全局安装时更有用,一次。
> grunt仅在本地安装(通过运行npm install grunt)。
> grunt-cli最好全局安装(通过运行npm install -g grunt-cli)。全球范围内安装grunt(无cli)。
>如果要卸载全局安装的grunt-cli,请运行npm uninstall -g grunt-cli。 This issue on gruntjs的项目支持此过程。
>不要全局安装grunt(通过运行npm install -g grunt)。
在npm和sudo
sudo不能很好地与npm。只有在必须使用它。下面是关于它的使用的优点和缺点的两个引号:
引用Isaac Z. Schlueter的他的Introduction to npm文章:
I strongly encourage you not to do package management with sudo!
Packages can run arbitrary scripts,which makes sudoing a package manager command
as safe as a chainsaw haircut. Sure,it’s fast and definitely going to cut
through any obstacles,but you might actually want that obstacle to stay there.I recommend doing this once instead:
sudo chown -R $USER /usr/local
That sets your user account as the owner of the /usr/local directory,so that you can
just issue normal commands in there. Then you won’t ever have to use sudo when you
install node or issue npm commands.It’s much better this way. /usr/local is supposed to be the stuff you installed,after all.
@H_301_104@Andrei Karpushonak提到的另一个问题:
There are certain security concerns and functionality limitations
regarding changing the ownership of /usr/local to the current user:
- if there is another user on the machine who Could use global
npm packages – do not change the ownership of /usr/local- 07006
- 07007
Having said that,if you want to install global module without using sudo,I don’t see any better solution (from pragmatic point of view) than mentioned. Security vs easy of use is very broad topic,and there is no easy answer for that – it just depends on your requirements.
@H_301_104@
gruntjs – 是否有一个注射器像grunt-wireep,适用于NPM依赖?
我目前依靠grunt-connectep来创建< script>包含在我的index.html中。此工具查看所有Bower配置,将所有必需的js和css文件拉入我的index.html。
是否有一个工具对于NPM依赖项会做同样的工作?
解决方法
要开始使用browserify,您需要先通过NPM全球安装
npm install -g browserify
然后在您的项目中,获取要包括的前端库,例如角度库
npm install --save angular
现在,您将需要使用require()使browserify了解项目需要获取的依赖关系(如果Angular应用程序在您定义主模块的位置添加此第一行)
var angular = require('angular'); angular .module('autocompleteDemo',[]) .controller('DemoCtrl',DemoCtrl);
要设置grunt-browserify任务,首先将其安装在项目中
npm install grunt-browserify --save-dev
并按如下所示配置任务
browserify: { main: { src: 'entry.js',dest: 'bundle.js' } }
最后在index.html中,您将需要为bundle.js脚本添加标记
<script src="bundle.js"></script>
示例代码可以在https://github.com/pra85/grunt-browserify-example找到
Laravel Mix:npm run dev 和 npm run watch 错误-> configuration.loader 应该是一个对象
如何解决Laravel Mix:npm run dev 和 npm run watch 错误-> configuration.loader 应该是一个对象?
我最近尝试使用 npm run watch
和 npm run dev
在开发平台上编译我的文件,但两者都给了我如下错误:
[webpack-cli] 无效的配置对象。已使用与 API 架构不匹配的配置对象初始化 Webpack。
- configuration.loader 应该是一个对象: 目的 { … } -> 加载程序上下文中可用的自定义值。
我不知道是什么原因造成的,我尝试搜索,但在网络上没有找到解决方案。
package.json
{
"private": true,"scripts": {
"dev": "npm run development","development": "mix","watch": "mix watch","watch-poll": "mix watch -- --watch-options-poll=1000","hot": "mix watch --hot","prod": "npm run production","production": "mix --production"
},"devDependencies": {
"@popperjs/core": "^2.0.6","@vue/test-utils": "^1.1.2","alpinejs": "^3.2.2","axios": "^0.21.1","babel-core": "^7.0.0-bridge.0","babel-jest": "^26.6.3","babel-loader": "^8.2.1","babel-preset-env": "^1.7.0","bootstrap": "^5.0.1","cross-env": "^7.0","cross-var": "^1.1.0","css-loader": "^5.2.7","jest": "^26.6.3","jquery": "^3.5.1","laravel-mix": "^6.0.25","livewire-vue": "^0.3.1","lodash": "^4.17.21","perfect-scrollbar": "^1.5.0","popper.js": "^1.16.1","pusher-js": "^7.0.3","resolve-url-loader": "^3.1.2","sass": "^1.32.8","sass-loader": "^12.1.0","socket.io-client": "^3.1.2","webpack": "^5.46.0","webpack-cli": "^4.7.2"
},"jest": {
"testURL": "http://localhost","roots": [
"<rootDir>/tests/Javascript/"
],"moduleNameMapper": {
"^@/(.*)$": "<rootDir>/resources/js/$1"
},"modulefileExtensions": [
"js","vue"
],"transform": {
"^.+\\.js$": "babel-jest",".*\\.(vue)$": "vue-jest"
}
},"dependencies": {
"@babel/polyfill": "^7.12.1","@chakra-ui/vue": "^0.6.6","@emotion/core": "^11.0.0","@emotion/react": "^11.1.1","@emotion/styled": "^11.0.0","acorn": "^8.0.4","babel-preset": "^1.1.7","bootstrap-icons": "^1.5.0","bootstrap-vue": "^2.19.0","bufferutil": "^4.0.2","canvas": "^2.6.1","clipboard": "^2.0.6","copy-webpack-plugin": "^9.0.1","core-js": "^3.7.0","emotion": "^10.0.27","formBuilder": "^3.6.1","html2canvas": "^1.0.0-rc.7","imagemagick": "^0.1.3","intersection-observer": "^0.11.0","js-cookie": "^2.2.1","lodash.remove": "^4.7.0","node-sass": "^6.0.0","portal-vue": "^2.1.7","react": "^17.0.1","regenerator-runtime": "^0.13.7","utf-8-validate": "^5.0.3","webrtc-adapter": "^7.7.0","yargs-parser": "^20.2.4"
},"resolutions": {
"yargs-parser": "^19.0.1"
}
}
更新:添加了 webpack.mix.js
webpack.mix.js
const mix = require(''laravel-mix'');
mix.setPublicPath(''public'')
.setResourceRoot(''../'')
.vue()
.sass(''resources/sass/frontend/app.scss'',''css/frontend.css'')
.sass(''resources/sass/backend/app.scss'',''css/backend.css'')
.js(''resources/js/frontend/app.js'',''js/frontend.js'')
.js([
''resources/js/backend/before.js'',''resources/js/backend/app.js'',''resources/js/backend/after.js''
],''js/backend.js'')
.js(''resources/js/global.js'',''js/global.js'')
.js(''resources/js/Banners/banner.js'',''js/banner.js'')
.extract([
// Extract packages from node_modules to vendor.js
''alpinejs'',''jquery'',''bootstrap'',''popper.js'',''axios'',''sweetalert2'',''lodash''
])
.sourceMaps();
if (mix.inProduction()) {
mix.version();
} else {
// Uses inline source-maps on development
mix.webpackConfig({
loader: ''url-loader'',devtool: ''inline-source-map''
});
}
上面的文件有问题吗?或者问题在其他地方仍然存在?
解决方法
在 webpack.mix.js 中
只需删除 loader: ''url-loader''
对我有用
我们今天的关于命令'npm run dev'失败NuxtJS和npm run dev出错的分享已经告一段落,感谢您的关注,如果您想了解更多关于cnpm run dev或npm run dev问题收集、gruntjs – 如何卸载npm包?、gruntjs – 是否有一个注射器像grunt-wireep,适用于NPM依赖?、Laravel Mix:npm run dev 和 npm run watch 错误-> configuration.loader 应该是一个对象的相关信息,请在本站查询。
本文标签: