当我安装nodemon时
sudo npm i --save-dev nodemon
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息:
npm ERR! path /home/dominikpatera/Dropbox/Projekty/Fytwa/server/node_modules/npm/node_modules/abbrev
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/home/dominikpatera/Dropbox/Projekty/Fytwa/server/node_modules/npm/node_modules/abbrev' -> '/home/dominikpatera/Dropbox/Projekty/Fytwa/server/node_modules/npm/node_modules/.abbrev.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dominikpatera/.npm/_logs/2018-07-11T09_45_21_545Z-debug.log
Run Code Online (Sandbox Code Playgroud)
你能帮我修一下吗?
我想使用以下命令通过提升的 PowerShell 控制台安装 Windows 构建工具:
npm install --global --production windows-build-tools
Run Code Online (Sandbox Code Playgroud)
但每次运行npm install上面的命令时,我都会收到以下错误:
windows-build-tools@5.2.2 postinstall C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools> node ./dist/index.js
C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\os.js:53
抛出结果错误;
^
错误:spawnSync powershell.exe ENOENT
在 Object.spawnSync (internal/child_process.js:1002:20)
在 Object.spawnSync (child_process.js:614:24)
在 spawnSync (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:67:36)
在 Object.queryRegFromPowershell (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:73:3)
在循环 (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:113:16)
在 opts.shift (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:116:7)
生成时 (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:100:5)
在 spawnSync (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:68:2)
在 Object.queryRegFromRegExe (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:96:3)
在循环 (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:113:16)
npm 错误!代码生命周期
npm 错误!错误号 1
npm 错误!windows-build-tools@5.2.2 安装后:`node ./dist/index.js`
npm 错误!退出状态 1
npm 错误!
npm 错误!在 windows-build-tools@5.2.2 安装后脚本失败。
npm 错误!这可能不是 npm 的问题。可能有额外的
上面的日志输出。
npm 错误!可以在以下位置找到此运行的完整日志:
npm 错误!C:\Users\AKA\AppData\Roaming\npm-cache\_logs\2019-09-02T01_30_08_978Z-debug.log
PS>节点-v …
我一直遇到这个错误,我不知道该怎么办。这是我的代码:
const fs = require('fs');
const archivo = fs.readFileSync('C:\Users\marco\OneDrive\Desktop\Code\WebDeveloping\txt\test.txt');
console.log(archivo);
Run Code Online (Sandbox Code Playgroud)
这是错误:
Error: ENOENT: no such file or directory, open 'C:UsersmarcoOneDriveDesktopCodeWebDeveloping xt est.txt'
at Object.openSync (node:fs:585:3)
at Object.readFileSync (node:fs:453:35)
at Object.<anonymous> (C:\Users\marco\OneDrive\Desktop\Code\WebDeveloping\js\index.js:57:20)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
errno: -4058,
syscall: 'open',
code: 'ENOENT',
path: 'C:UsersmarcoOneDriveDesktopCodeWebDeveloping\txt\test.txt'
}
Run Code Online (Sandbox Code Playgroud)
所有文件都存在,这就是它们的正确路径
node.js的新手,并在下面的链接中遵循基本教程. https://www.tutorialspoint.com/nodejs/nodejs_web_module.htm
var http = require('http');
var fs = require('fs');
var url = require('url');
// Create a server
http.createServer( function (request, response) {
// Parse the request containing file name
var pathname = url.parse(request.url).pathname;
// Print the name of the file for which request is made.
console.log("Request for " + pathname + " received.");
// Read the requested file content from file system
fs.readFile(pathname.substr(1), function (err, data) {
if (err) {
console.log(err);
// HTTP Status: 404 : NOT FOUND
// …Run Code Online (Sandbox Code Playgroud)