Tag: npm

获取__dirname指向文件夹path,而不是实际连接的文件夹path

如何让__dirname指向保存的文件夹path,而不是使用npm链接的符号链接文件的实际path。 脚本 文件夹设置 project | —- moduleA | | | —- moduleA.js | —- app | — node_modules cd project/moduleA npm link cd project/app npm link moduleA 在moduleA.js里面 __dirname -> /project/moduleA 但是,预期的行为是 __dirname -> /project/app/node_modules/moduleA 因为npm链接会创build一个sym-link,将链接的模块插入到node_modules文件夹中,从而模拟直接安装模块的体验。 我怎样才能让__dirname指向保存的path,而不是模块所在的真实path? 注意:–preserve-symlinks命令行选项不会影响__dirname的值

Npm安装总是返回`代码ECONNREFUSED`错误的所有pakcages

`npm ERR! code ECONNREFUSED npm ERR! errno ECONNREFUSED npm ERR! FetchError: request to http://registry.npmjs.org/body-parser failed, reason: connect ECONNREFUSED 127.0.0.1:3000` 我尝试了proxy settings , registry set commands ..但仍然没有用.. 我使用节点js最新版本..我的应用程序监听端口是3000 我试过npm config List ..有没有错误的configuration? `; cli configs metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/5.3.0 node/v8.1.4 win32 ia32" ; userconfig C:\Users\JANEN\.npmrc https-proxy = "http://proxy.company.com:8080/" proxy = "http://proxy.company.com:8080/" […]

npm与巴贝尔和webpack创build反应应用程序不起作用

我是新兴的UI技术。 我正在尝试我的手在reactjs随着webpack和babel我创build了一个应用程序后使用npm安装它使用create-react-app插件。 我进入src文件夹并执行npm start,启动浏览器并显示演示页面。 我试图添加babel和webpack到这个演示,但不幸的是它不工作。 我打开浏览器中的index.html页面,它不显示我所遵循的jsx文件内容https://www.codementor.io/tamizhvendan/beginner-guide-setup-reactjs-environment-npm-babel-6-的WebPack-du107r9zr 我不知道为什么这不起作用,可以请一些帮助吗? index.jsx import React from 'react'; import {render} from 'react-dom'; class App extends React.Component { render () { return <p> Hello React!</p>; } } render(<App/>, document.getElementById('app')); 的index.html <html> <head> <meta charset="utf-8"> <title>React.js using NPM, Babel6 and Webpack</title> </head> <body> <div id="app" /> <script src="public/bundle.js" type="text/javascript"></script> </body> </html> .babelrc文件 { […]

如何添加一个Spring Boot项目的Node模块?

我正在用Spring后端和React前端创build一个Web应用程序。 它的configuration基于这个最小的Spring Boot / React项目 。 现在我想在这个项目中使用react-checkbox-tree组件。 我该怎么做? 我尝试了两个不同的东西。 尝试1 在pom.xml文件中,使用以下声明包含React模块: <dependency> <groupId>org.webjars.npm</groupId> <artifactId>react</artifactId> <version>15.6.1</version> </dependency> 我试图find树组件的这种工件,但不能。 Attemp 2 我尝试将树组件安装为全局模块( npm install -g react-checkbox-tree )。 它没有帮助。 我得到错误 [INFO] ERROR in ./src/main/js/app.js [INFO] Module not found: Error: Cannot resolve module 'react-checkbox-tree' in C:\myproject\src\main\js [INFO] @ ./src/main/js/app.js 5:25-55 在build立。 更新1(13.08.2017 23:57): 在WebJars主页上,我find了关于如何将Node模块打包为WebJar的教程(以便它可以像正常的Maven依赖项一样集成到Spring Boot项目中)。 我开始为react-checkbox-tree创buildWebJar项目。 你可以在这里find源代码。 目前的问题是在本教程的pom.xml中提到的UPSTREAM_ZIP_URL : […]

npm在Windows上运行“DEBUG = *”问题

{ "name": "apokidsi", "version": "0.717", "contributors": [ ], "dependencies": { "angular": "1.5.8", "angular-cookies": "1.5.8", "angular-messages": "1.5.8", "angular-ui-router": "1.0.0-beta.3", "debug": "^3.0.0", "flag-icon-css": "2.8.0", "jquery": "3.2.1", "moment": "2.18.1", "moment-timezone": "0.5.13", "node-fetch-npm": "^2.0.1" }, "scripts": { "clean": "gulp clean", "start": "DEBUG=true HOST=localhost:4200 gulp server", } } 这是package.json文件。 当我运行npm run start 我得到这个消息 “DEBUG”不被识别为内部或外部命令,可操作程序或batch file。 npm ERR! 代码ELIFECYCLE npm ERR! […]

React本机应用程序无法在Android中启动,并在debugging版本上显示多条警告消息

环境 react-native-cli:2.0.1,node:v8.2.1,npm:5.3.0, 目标平台:Android 5.0 x86-64图像 开发操作系统:Windows 7专业版,x86_64 的package.json "dependencies": { "axios": "^0.16.2", "buffer": "^5.0.6", "lodash": "^4.17.4", "mobx": "^3.2.1", "mobx-react": "^4.2.2", "react": "16.0.0-alpha.12", "react-native": "0.45.1", "react-native-background-timer": "^1.1.0", "react-native-fetch-blob": "latest", "react-native-timer": "^1.3.1" }, "devDependencies": { "babel-jest": "20.0.3", "babel-preset-react-native": "2.0.0", "jest": "20.0.4", "react-test-renderer": "16.0.0-alpha.12", "tslint": "^5.4.3", "typescript": "^2.4.1", "typings": "^2.1.1" }, 重现步骤 npm安装,npm运行构build,react-native run-android 预期的行为 这应该是在通过USB连接的物理设备上或运行的仿真器上成功启动应用程序。 实际行为 应用程序无法启动这些警告消息: […]

Npm包提供一个Material-UI HOC到一个Nextjs应用程序

问题描述 我正在尝试通过npm包提供Material-UI到Nextjs应用程序。 npm包使用Webpack。 这一切正常,但我得到一个错误消息。 这个东西稍微超出了我对npm packages&webpack的理解,我可能不会这样做,如果是这样的话,请提供build议。 错误消息 警告:上下文types失败: 64a55d578f856d258dc345b094a2a2b3types的上下文64a55d578f856d258dc345b094a2a2b3提供给withStyles(ButtonBase) , Jss预期实例。 警告:上下文types失败:提供给withStyles(TouchRipple)types的SheetsRegistrytypes的无效上下文d4bd0baacbc52bbd48bbb9eb24344ecd ,为withStyles(TouchRipple)预期实例。 重现步骤 这只会让你检查错误。 git clone https://github.com/astenmies/next-library-starter.git && cd next-library-starter && yarn && yarn run dev 调整npm包的步骤 这将让你检查错误,并调整本地运行的npm包。 首先得到npm包并运行它 git clone https://github.com/astenmies/next.js-library.git && cd next.js-library && yarn && yarn run dev 然后在你的terminal的另一个选项卡上,在上述相同的根目录下…获取nextjs应用程序,删除npm包,获取linklocal并运行应用程序。 git clone https://github.com/astenmies/next-library-starter.git && cd next-library-starter && yarn remove next-library && yarn […]

在NPM中包含依赖于package.json

我是新来的node.js我已经手动添加库到node_modules,而不使用命令行NPM安装…现在,我结束了很多没有包含在package.json中的库。 有无论如何自动添加从我的node_modules依赖我的package.json文件?

如何解决以下浏览错误?

我是新来的使用gulp和browserify。 我正在尝试使用browserify和gulp在线教程。 以下是我的package.json { "name": "progressive", "version": "1.0.0", "description": "Practcing a Progressive Web App", "scripts": { "start": "node ./index.js" }, "author": "Indu Pillai", "devDependencies": { "browserify": "^13.1.0", "gulp": "^3.8.8", "gulp-browserify": "^0.5.1", "gulp-clean-css": "^2.0.13", "gulp-concat-css": "^2.3.0", "gulp-if": "^2.0.1", "gulp-sourcemaps": "^2.2.0", "gulp-uglify": "^2.0.0", "gulp-util": "^2.2.20", "gulp-webserver": "^0.8.8", "jquery": "^3.1.1", "sw-precache": "^4.2.1" }, "dependencies": { "handlebars": "^4.0.5" } […]

运行npm run build vue后,某些图片没有被加载

我完成了我的Vue应用程序,并运行npm run build部署应用程序。 一切似乎都很好。 但是,我的一些图片将无法运行。 我的四个图像渲染得很好。 但是,这四个图像不在我的img文件夹中。 在控制台上,我得到这个错误: GET file:///C:/static/img/Two.550dff0.jpeg net::ERR_FILE_NOT_FOUND 图像名称是“Two.550dff0.jpeg”,它位于img文件夹中,但应用程序无法访问它。 这是为什么? 而且,对于渲染的四个图像,这些图像不在img文件夹中。 我也无法在dist文件夹中find这四个图像。 这是index.HTML代码: <script type=text/javascript src=static/js/manifest.1f30a815db1d214533a9.js></script> <script type=text/javascript src=static/js/vendor.0757592c5dae8c3165a1.js></script> <script type=text/javascript src=static/js/app.53c259c8c3df1ec9179f.js></script>