我正在制作一个网站,我使用命令npm start
将它放在localhost上。但是,在Visual Studio代码编辑器上创建了两个工作区之后,它突然停止了工作。它只给我一个错误。
这就是错误:
npm ERR!路径C:\ Users \ audre \ first-blog \ package.json
npm ERR!代码ENOENT
npm ERR! errno -4058
npm ERR!系统调用打开
npm ERR! enoent ENOENT:没有这样的文件或目录,打开' C:\ Users \ audre \ first-blog \ package.json'
npm ERR! enoent这与npm无法找到文件有关。
npm ERR! ENOENT
npm ERR!可以在以下位置找到此运行的完整日志:
npm ERR! C:\ Users \用户audre \应用程序数据\漫游\ NPM-cache_logs \ 2018-05-29T07_42_13_915Z-的debug.log
我不知道这意味着什么。谁能帮我?谢谢!
编辑: 我的package.json文件包含以下内容:
{
"name": "pug-starter",
"version": "1.0.0",
"description": "Simple pug (jade) starter [framework] enabling faster delivery of HTML & CSS projects to a private server and/or automatic deployment of GitHub pages.",
"main": "index.js",
"scripts": {
"dev": "gulp dev",
"start": "gulp dev",
"prod": "gulp build --production",
"deploy": "gulp build --production && gulp deploy && gulp clean:ghpages",
"test": "echo \"Error: no test specified\" && exit 1"
},
"//": "CUSTOM CONFIGURATION",
"config": {
"directory": {
"development": "tmp",
"production": "build",
"ghpages": ".publish",
"source": "src",
"data": "_data",
"component": "_component",
"layout": "_layout",
"asset": "_asset",
"image": "image",
"font": "font",
"templateCollection": [
"article",
"product"
]
},
"render": {
"sourceFileChange": false,
"url": {
"//": "this is recommended to avoid Linux/Windows capitalization issue",
"htmlExtensionOn": false,
"toLowercase": true
}
},
"entry": {
"cssExternal": "style**.{scss,sass}",
"cssInline": "inline**.{scss,sass}",
"css": {
"inline": false,
"external": true
}
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/marianzburlea/pug-starter.git"
},
"keywords": [
"pug",
"starter",
"jade",
"starter"
],
"author": "Marian Zburlea",
"license": "MIT",
"bugs": {
"url": "https://github.com/marianzburlea/pug-starter/issues"
},
"homepage": "https://github.com/marianzburlea/pug-starter#readme",
"devDependencies": {
"autoprefixer": "^6.7.5",
"babel-core": "^6.26.0",
"babel-eslint": "^8.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-env": "^1.6.1",
"browser-sync": "^2.18.8",
"eslint": "^3.16.1",
"foldero": "^0.1.1",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-cached": "^1.1.1",
"gulp-changed": "^2.0.0",
"gulp-changed-in-place": "^2.2.0",
"gulp-debug": "^3.1.0",
"gulp-gh-pages": "^0.5.4",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^3.1.1",
"gulp-inline-source": "^3.0.0",
"gulp-load-plugins": "^1.5.0",
"gulp-plumber": "^1.1.0",
"gulp-postcss": "^6.3.0",
"gulp-pug": "^3.2.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^3.1.0",
"gulp-sourcemaps": "^2.4.1",
"imagemin-jpegoptim": "^5.0.0",
"imagemin-pngquant": "^5.0.0",
"imagemin-svgo": "^5.2.0",
"jstransformer-markdown-it": "^2.0.0",
"merge-stream": "^1.0.1",
"minimist": "^1.2.0"
}
}

答案 0 :(得分:1)
当其他所有方法都失败时,请完全删除/重新安装node.js.当您在所有节点env命令中全面发生错误时,这意味着节点已损坏或以某种方式出错。
答案 1 :(得分:0)
使用负责环境的流程管理器。
几个选项
<强>永久强>(https://www.npmjs.com/package/forever)
使用此功能,您可以使用forever start <mainfilename>
PM2 (https://www.npmjs.com/package/pm2)
使用此功能,您可以使用pm2 start <mainfilename>
对于流程经理,您需要从环境规范中抽象出来,直到您需要更具体的内容。
答案 2 :(得分:0)
ENOENT表示在运行npm start
命令的情况下,该目录不包含package.json文件。
首先,确保您位于正确的目录中,并且它具有package.json文件。
此外,如果没有package.json文件,您可以使用npm init
命令对其进行初始化。
如果不是这种情况,请随时删除评论以纠正我。
答案 3 :(得分:0)
还有另一种解决方法。
我还可以输入VS Code终端cd fantastic-website
和cd first-blog
。
也可以。
答案 4 :(得分:0)
如果您的计算机上有多个版本的nodejs,并且正在运行节点版本管理器(nvm),请确保在终端中正确设置版本。
例如 nvm使用v9.5.0