我运行程序,提示如上图,我依照提示安装fs: 重新运行之后还是提示那个错误,求解 在线等,各位大大请支招啊
–save
两个 - 看一下你的node_modules里是否有这个模块
fs 不是自带的模块么
@liujavamail 两个杠我也试了,一样的结果
@Alexis374 我在node.js安装目录下找到如下: 没有找到fs的目录,这正常吗? 我node安装的有问题?
你的这个包是用来做什么的, 是node自带处理文件的吗?
@liujavamail 我在用node连mysql数据库,提示的这个错,但我并没有直接用这个模块
@liujavamail 我试着直接使用fs模板,报一样的错,应该就是node自带处理文件的,嗯,一定是
你进入node控制台,
require('fs')
会有问题吗?
@liujavamail 出来了好大一坨,但没报错
@liujavamail 但我在js里var myfs = require(‘fs’); 就会出错
你单独写一个文件,不要package.json目录, 直接 var myfs = require(‘fs’); 还会报错吗?
我试了一下,我这边是没有报错的
@liujavamail 不会,那没事
@liujavamail 是package.json的问题? { “name”: “my-vue-log”, “version”: “1.0.0”, “description”: “my work log”, “author”: “Claudia”, “private”: true, “scripts”: { “dev”: “node build/dev-server.js”, “build”: “node build/build.js”, “unit”: “cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run”, “e2e”: “node test/e2e/runner.js”, “test”: “npm run unit && npm run e2e” }, “dependencies”: { “fs”: “0.0.1-security”, “mysql”: “^2.12.0”, “net”: “^1.0.2”, “tls”: “0.0.1”, “vue”: “^2.1.0” }, “devDependencies”: { “autoprefixer”: “^6.4.0”, “babel-core”: “^6.0.0”, “babel-loader”: “^6.0.0”, “babel-plugin-transform-runtime”: “^6.0.0”, “babel-preset-es2015”: “^6.0.0”, “babel-preset-stage-2”: “^6.0.0”, “babel-register”: “^6.0.0”, “chalk”: “^1.1.3”, “connect-history-api-fallback”: “^1.1.0”, “css-loader”: “^0.25.0”, “eventsource-polyfill”: “^0.9.6”, “express”: “^4.13.3”, “extract-text-webpack-plugin”: “^1.0.1”, “file-loader”: “^0.9.0”, “friendly-errors-webpack-plugin”: “^1.1.2”, “function-bind”: “^1.0.2”, “html-webpack-plugin”: “^2.8.1”, “http-proxy-middleware”: “^0.17.2”, “json-loader”: “^0.5.4”, “cross-env”: “^3.1.3”, “karma”: “^1.3.0”, “karma-coverage”: “^1.1.1”, “karma-mocha”: “^1.2.0”, “karma-phantomjs-launcher”: “^1.0.0”, “karma-sinon-chai”: “^1.2.0”, “karma-sourcemap-loader”: “^0.3.7”, “karma-spec-reporter”: “0.0.26”, “karma-webpack”: “^1.7.0”, “lolex”: “^1.4.0”, “mocha”: “^3.1.0”, “chai”: “^3.5.0”, “sinon”: “^1.17.3”, “sinon-chai”: “^2.8.0”, “inject-loader”: “^2.0.1”, “babel-plugin-istanbul”: “^3.0.0”, “phantomjs-prebuilt”: “^2.1.3”, “chromedriver”: “^2.21.2”, “cross-spawn”: “^4.0.2”, “nightwatch”: “^0.9.8”, “selenium-server”: “2.53.1”, “semver”: “^5.3.0”, “opn”: “^4.0.2”, “ora”: “^0.3.0”, “shelljs”: “^0.7.4”, “url-loader”: “^0.5.7”, “vue-loader”: “^10.0.0”, “vue-style-loader”: “^1.0.0”, “vue-template-compiler”: “^2.1.0”, “webpack”: “^1.13.2”, “webpack-dev-middleware”: “^1.8.3”, “webpack-hot-middleware”: “^2.12.2”, “webpack-merge”: “^0.14.1” }, “engines”: { “node”: “>= 4.0.0”, “npm”: “>= 3.0.0” } } 这是我的package.json,能帮我看看有问题吗?
“fs”: “0.0.1-security”,
“mysql”: “^2.12.0”,
“net”: “^1.0.2”,
“tls”: “0.0.1”,
“vue”: “^2.1.0”
}
这里面有一个fs
做什么用的?
@liujavamail 我安装fs他自己写上的
删了, 重新npm install 一遍,看看还有这个问题没
@liujavamail 不管用
@liujavamail 虽然没有解决问题,但还是感谢你的耐心解答,添麻烦了 From Noder
node安装有问题?fs
是内置模块啊
两个问题可能: 1.node版本问题 2.安装问题
直接
var fs = require('fs')
即可
看看怎么上
fs不是官方库么?哪个第三方的库不开眼叫这个名字?
解决了吗?遇到一样的问题